Problem:


Score : 300 points

Problem Statement

In AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:  

Rating 1-399 : gray

Rating 400-799 : brown

Rating 800-1199 : green

Rating 1200-1599 : cyan

Rating 1600-1999 : blue

Rating 2000-2399 : yellow

Rating 2400-2799 : orange

Rating 2800-3199 : red

Other than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.

Currently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.

Find the minimum and maximum possible numbers of different colors of the users.  

Constraints

1 ≤ N ≤ 100

1 ≤ a_i ≤ 4800

a_i is an integer.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

Print the minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.  

Sample Input 1

4
2100 2500 2700 2700

Sample Output 1

2 2

The user with rating 2100 is "yellow", and the others are "orange". There are two different colors.  

Sample Input 2

5
1100 1900 2800 3200 3200

Sample Output 2

3 5

The user with rating 1100 is "green", the user with rating 1900 is blue and the user with rating 2800 is "red".

If the fourth user picks "red", and the fifth user picks "blue", there are three different colors. This is one possible scenario for the minimum number of colors.

If the fourth user picks "purple", and the fifth user picks "black", there are five different colors. This is one possible scenario for the maximum number of colors.  

Sample Input 3

20
800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990

Sample Output 3

1 1

All the users are "green", and thus there is one color.



Sample input:
4
2100 2500 2700 2700


Sample output:
2 2

Submission status: Accepted

Solution code:
n = int(input())
a = list(int(i) for i in input().split())
color = []
for i in range(n):
    for j in range(8):
        if a[i]>=400*j and a[i]<400*(j+1):
            color.append(j)
            break
        elif a[i]>=3200:
            color.append(8)
            break

color_map = {}
for c in color:
    if not c in color_map.keys():
        color_map[c] = 1
    else:
        color_map[c] += 1

cmin = 0
cmax = 0
for k,v in color_map.items():
    if not k==8:
        cmin += 1
    else:
        cmax += v
cmax = cmin+cmax
if cmin==0:
    cmin = 1
print(cmin,cmax)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
arr = [0] * 8
q = 0
for i in a:
    if i >= 3200:
        q += 1
    else:
        arr[i // 400] += 1
p = 0
for i in arr:
    if i != 0:
        p += 1
print(max(1, p), p + q)

Submission status: Accepted

Solution code:
import bisect
N = int(input())
rate = sorted(list(map(int,input().split())))
allcoder = 0
for i in range(N):
    if rate[i] > 3199:
        allcoder += 1
color = 0        
for i in range(8):
    if bisect.bisect_left(rate,i*400 if i>0 else 1) != bisect.bisect_right(rate,i*400+399) :
        color += 1
print(max(color,1),color+allcoder)

Submission status: Accepted

Solution code:
N = int(input())
A = [0] * 9
for a in list(map(int, input().split())):
    A[min(a//400, 8)] += 1

ans = len(list(filter(lambda x: x>0, A[:-1])))

max_ans = ans+A[-1]

if A[-1] > 0:
    min_ans = max(1, ans)
else:
    min_ans = ans
print(min_ans, end=" ")
print(max_ans)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
#print(n,a)

ansa=[0]*8
ansb=0
for i in range(n):
  if a[i]<400:
    ansa[0]=1
  elif a[i]<800:
    ansa[1]=1
  elif a[i]<1200:
    ansa[2]=1
  elif a[i]<1600:
    ansa[3]=1
  elif a[i]<2000:
    ansa[4]=1
  elif a[i]<2400:
    ansa[5]=1
  elif a[i]<2800:
    ansa[6]=1
  elif a[i]<3200:
    ansa[7]=1
  else:
    ansb+=1
    
if sum(ansa)==0:
  print(1,ansb)
else:  
  print(sum(ansa),sum(ansa)+ansb)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]

c=[0 for i in range(8)]
r=0

for i in a:
    if 1<=i and i<=399:
        c[0]+=1
    elif 400<=i and i<=799:
        c[1]+=1
    elif 800<=i and i<=1199:
        c[2]+=1
    elif 1200<=i and i<=1599:
        c[3]+=1
    elif 1600<=i and i<=1999:
        c[4]+=1
    elif 2000<=i and i<=2399:
        c[5]+=1
    elif 2400<=i and i<=2799:
        c[6]+=1
    elif 2800<=i and i<=3199:
        c[7]+=1
    elif 3200<=i:
        r+=1

s=0
for i in c:
    if i!=0:
        s+=1

b=s+r

if s==0:
    s=1
    b=r

print(s,b)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]
colors = [0] * 9
for a in A:
    c = a // 400
    if c < 8:
        colors[c] = 1
    else:
        colors[8] += 1
print(max(sum(colors[:8]), 1), sum(colors))

Submission status: Accepted

Solution code:
N = int(input())
L = list(map(int,input().split()))
D = {}
p = 0
for i in range(N) :
    if L[i] < 400 :
        color = 0
    elif L[i] < 800 :
        color = 1
    elif L[i] < 1200 :
        color = 2
    elif L[i] < 1600 :
        color = 3
    elif L[i] < 2000 :
        color = 4
    elif L[i] < 2400 :
        color = 5
    elif L[i] < 2800 :
        color = 6
    elif L[i] < 3200 :
        color = 7
    else :
        p += 1
    if L[i] < 3200 :
        if color not in D :
            D[color] = 1
        else :
            D[color] += 1
ans1 = len(list(D.keys()))
q = 0
if ans1 == 0 :
    ans1 = 1
    q = 1
ans2 = ans1 + p - q
print(ans1,ans2)

Submission status: Accepted

Solution code:
N=int(input())
a=[int(i)//400 for i in input().split()]
s=set()
r=0
for i in range(N):
    if a[i]>=8:
        r+=1
    else:
        s.add(a[i])
print("{0} {1}".format(max([1,len(s)]),len(s)+r))

Submission status: Accepted

Solution code:
N = input()
A = map(lambda x: int(x)/400, raw_input().split())
S = set()
ans = 0
for a in A:
  if a <= 7:
    S.add(a)
  else:
    ans += 1

if len(S) == 0:
    print 1, ans
else:
    print len(S), ans + len(S)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))

count = 0
exist = [0] * 8

for ai in a:
    if ai < 3200:
        exist[ai // 400] = 1
    else:
        count += 1

temp = sum(exist)

if temp == 0:
    print(1, count)
else:
    print(temp, temp + count)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
cs = set()
free = 0
for a in A:
    if a < 3200:
        cs.add(a//400)
    else:
        free += 1
print(max(1,len(cs)), len(cs)+free)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
Free = len([a for a in A if a >= 3200])
NotFree = len(set([a // 400 for a in A if a < 3200]))

if NotFree == 0:
    print(1, Free)
else:
    print(NotFree, NotFree + Free)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
p = [0] * 8
q = 0
for i in a:
    if i // 400 >= 8:
        q += 1
    else:
        p[i//400] += 1
pp = 0
for qqqq in p:
    if qqqq != 0:
        pp += 1
print(max(1,pp), pp + q)

Submission status: Accepted

Solution code:
import numpy as np
Level = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
N = int(input())
Point = [int(x) for x in input().split()]

def solve():
    count = np.zeros(len(Level), dtype=int)
    for p in Point:
        over3200 = True
        for i in range(1, len(Level)):
            if p<Level[i]: 
                count[i-1] += 1
                over3200 = False
                break
        if over3200: count[-1] += 1
#    print(count)
    colorCount = 0
    for i in range(len(count)-1): #3200点以上は除く
        if count[i]>0: colorCount += 1
    
#    return max(colorCount, 1), min(colorCount + count[-1], len(Level) - 1)
    return max(colorCount, 1), colorCount + count[-1]


#print(N)
#print(Point)
mi, ma = solve()
print(mi, ma)

Submission status: Accepted

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
color = [0] * 9
ans1, ans2 = 0, 0
for i in a:
    if i <= 399:
        color[0] = 1
    elif i <= 799:
        color[1] = 1
    elif i <= 1199:
        color[2] = 1
    elif i <= 1599:
        color[3] = 1
    elif i <= 1999:
        color[4] = 1
    elif i <= 2399:
        color[5] = 1
    elif i <= 2799:
        color[6] = 1
    elif i <= 3199:
        color[7] = 1
    else:
        color[8] += 1

ans1 = sum(color)
ans2 = sum(color[:8])
if ans2 == 0:
    ans2 = 1
print(ans2, ans1)

Submission status: Accepted

Solution code:
def abc064_c():
    _ = int(input())
    a = list(map(int, input().split()))
    color = [False] * 8
    higher = 0
    for v in a:
        if v >= 3200:
            higher += 1
        else:
            color[v // 400] = True
    if sum(color) == 0:
        print(1, higher)
    else:
        print(sum(color), sum(color) + higher)


abc064_c()

Submission status: Accepted

Solution code:
n = input()
a = list(map(int, input().split()))
colored = [0,0,0,0,0,0,0,0]
god = 0
for i in a:
  if i >= 3200:
    god += 1
  else:
    colored[i // 400] += 1
color = 8 - colored.count(0)
if color == 0:
  print(1,god)
else:
  print(color, color+god)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
d = [0]*8
over = 0
for i in a:
    lv = i//400
    if lv < 8:
        d[lv] = 1
    else:
        over += 1

print(max(sum(d), 1), sum(d)+over)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
from collections import defaultdict
d = defaultdict(int)
over = 0
for i in a:
    lv = i//400
    if lv < 3200//400 and not d[lv]:
        d[lv] = True
    if lv >= 3200//400:
        over += 1

syurui = sum(d.values())
print(max(1, syurui), syurui+over)

Submission status: Accepted

Solution code:
N = int(input())
a = [int(e) for e in input().split()]

su = [0] * 9
for e in a:
    if e >= 3200:
        su[8] += 1
    else:
        su[e//400] += 1
mi = 0
for e in su[:8]:
    if e != 0:
        mi += 1
ma = mi+su[8]
mi = max(1, mi)
print(mi, ma)

Submission status: Accepted

Solution code:
N = int(input().strip())
a = list(map(int, input().strip().split()))
cl = [0 for _ in range(9)]

for _a in a:
  cl[min(_a//400, 8)] += 1

f = cl[-1]
minc = sum([1 for c in cl[:8] if c!=0])
print(max(minc, 1), minc + f)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))

L=[0]*8

RED=0

for i in range(N):
    if A[i]//400>=8:
        RED+=1
    else:
        L[A[i]//400]=1
    
print(max(sum(L),1),sum(L)+RED)

Submission status: Accepted

Solution code:
rate = [0 for _ in range(8)]
frate = 0

n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    if a[i] < 400:
        rate[0] += 1

    elif a[i] < 800:
        rate[1] += 1

    elif a[i] < 1200:
        rate[2] += 1

    elif a[i] < 1600:
        rate[3] += 1

    elif a[i] < 2000:
        rate[4] += 1

    elif a[i] < 2400:
        rate[5] += 1

    elif a[i] < 2800:
        rate[6] += 1

    elif a[i] < 3200:
        rate[7] += 1

    else:
        frate += 1

#print(rate)

iro = len(list(filter(lambda x: x != 0, rate)))

if iro == 0:
    print(1, frate)

elif frate == 0:
    print(iro, iro)

else:
    print(iro, iro + frate)

Submission status: Accepted

Solution code:
def main():
    _ = input()
    aa = map(int, input().split())
    counts = [0] * 9
    for a in aa:
        a //= 400
        counts[min(a, 8)] += 1
    color = sum(map(lambda c: 1 if c > 0 else 0, counts[:-1]))
    if counts[-1] == 0:
        print(color, color)
    else:
        print(max(color, 1), color + counts[-1])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    a = list(map(int, input().split()))
    gray = brown = green = cyan = blue = yellow = orange = red = other = 0
    for ai in a:
        if 1 <= ai <= 399 and gray == 0:
            gray = 1
        elif 400 <= ai <= 799 and brown == 0:
            brown = 1
        elif 800 <= ai <= 1199 and green == 0:
            green = 1
        elif 1200 <= ai <= 1599 and cyan == 0:
            cyan = 1
        elif 1600 <= ai <= 1999 and blue == 0:
            blue = 1
        elif 2000 <= ai <= 2399 and yellow == 0:
            yellow = 1
        elif 2400 <= ai <= 2799 and orange == 0:
            orange = 1
        elif 2800 <= ai <= 3199 and red == 0:
            red = 1
        elif 3200 <= ai <= 4800:
            other += 1
    ans_max = gray + brown + green + cyan + blue + yellow + orange + red + other
    if gray + brown + green + cyan + blue + yellow + orange + red == 0:
        ans_min = 1
    else:
        ans_min = gray + brown + green + cyan + blue + yellow + orange + red
    print(str(ans_min) + " " + str(ans_max))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
l=[0 for i in range(9)]
for j in range(n):
  l[min(a[j],3200)//400]+=1
c=0
for k in range(len(l)-1):
  if l[k]>0:c+=1
if c==0:print(1,c+l[8])
else:print(c,c+l[8])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a = list(map(lambda x:x//400, a))
a.sort()
tourist = 0
for i in range(n):
	if a[i]>=8:
		tourist = n-i
		break
min = len(set(a[:n-tourist]))
max = min + tourist
if min==0:
	min=1
print(min, max)

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

N = int(input())
a = list(map(int, input().split()))
s = set()
cnt = 0
for v in a:
    if 1 <= v <= 399:
        s.add(1)
    elif 400 <= v <= 799:
        s.add(2)
    elif 800 <= v <= 1199:
        s.add(3)
    elif 1200 <= v <= 1599:
        s.add(4)
    elif 1600 <= v <= 1999:
        s.add(5)
    elif 2000 <= v <= 2399:
        s.add(6)
    elif 2400 <= v <= 2799:
        s.add(7)
    elif 2800 <= v <= 3199:
        s.add(8)
    elif 3200 <= v:
        cnt += 1
print(max(1,len(s)), len(s) + cnt)

Submission status: Accepted

Solution code:
N = int(input())
R = [int(i) for i in input().split()]
S = set()
f = 0
for i in R:
    if i//400 < 8:
        S.add(i//400)
    else:
        f += 1

t = max(1,len(S)) 
mx = len(S)+f
print(t,mx)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[0]*8
free=0
for i in a:
    if i<400:
        b[0]+=1
    elif i<800:
        b[1]+=1
    elif i<1200:
        b[2]+=1
    elif i<1600:
        b[3]+=1
    elif i<2000:
        b[4]+=1
    elif i<2400:
        b[5]+=1
    elif i<2800:
        b[6]+=1
    elif i<3200:
        b[7]+=1
    else:
        free+=1
tmp=[i for i in b if i>0]
min_color=max(1,len(tmp))
max_color=len(tmp)+free
print("{} {}".format(min_color,max_color))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

s = set()
c = 0

for i in range(n):
    if 1 <= a[i] <= 399:
        s.add(1)

    elif 400 <= a[i] <= 799:
        s.add(2)

    elif 800 <= a[i] <= 1199:
        s.add(3)

    elif 1200 <= a[i] <= 1599:
        s.add(4)

    elif 1600 <= a[i] <= 1999:
        s.add(5)

    elif 2000 <= a[i] <= 2399:
        s.add(6)

    elif 2400 <= a[i] <= 2799:
        s.add(7)

    elif 2800 <= a[i] <= 3199:
        s.add(8)

    else:
        c += 1

if len(s):
    print(len(s), len(s)+c)
else:
    print(1, c)

Submission status: Accepted

Solution code:
N = int(input())
all = 0
colors = [0] * 8
for a in map(int, input().split()):
  if a >= 3200:
    all += 1
  else:
    colors[a // 400] = 1
print(max(sum(colors), 1), sum(colors) + all)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
rate = [0] * 9
for e in A:
    for i in range(8,-1,-1):
        if e >= 400*i:
            rate[i] += 1
            break
rate_ex = rate[:-1]
color_kind = 0
for e in rate_ex:
    if e > 0:
        color_kind += 1
min_kind = color_kind 
if min_kind == 0:
    min_kind = 1
max_kind = color_kind + rate[-1]
print(min_kind,max_kind)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
iro=[0 for i in range(8)]
tyi=0
for i in range(n):
  if a[i]<3200:
    iro[int(a[i]/400)]=1
  else:
    tyi+=1
print(max(iro.count(1),1),iro.count(1)+tyi)

Submission status: Accepted

Solution code:
N = int(input())
al = map(int, input().strip().split(" "))

additional = 0
dic = {}
for a in al:
    if 1 <= a <= 399:
        dic['0'] = 0
    if 400 <= a <= 799:
        dic['1'] = 0
    if 800 <= a <= 1199:
        dic['2'] = 0
    if 1200 <= a <= 1599:
        dic['3'] = 0
    if 1600 <= a <= 1999:
        dic['4'] = 0
    if 2000 <= a <= 2399:
        dic['5'] = 0
    if 2400 <= a <= 2799:
        dic['6'] = 0
    if 2800 <= a <= 3199:
        dic['7'] = 0
    if 3200 <= a:
        additional += 1

leng = len(dic.keys())
print(max(leng, 1), leng + additional)

Submission status: Accepted

Solution code:
N = input()
rates = [int(i) for i in input().split()]

color = [0] * 9
for rate in rates:
    if rate/400 < 8:
        color[int(rate/400)] += 1
    else:
        color[8] += 1

num = 0
for i in color[:8]:
    if i:
        num += 1

if num:
    mi = num
    ma = num + color[8]
else:
    mi = 1
    ma = num + color[8]

print("{} {}".format(mi,ma))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
nl=[0 for i in range(8)]
c=0
for i in range(len(a)):
    if a[i]>=3200:
        c+=1
    for j in range(8):
        if 400*j<=a[i] and a[i]<400*(j+1):
            nl[j]=1
if sum(nl)==0:
    m=1
else:
    m=sum(nl)
print(m,sum(nl)+c)

Submission status: Accepted

Solution code:
N=int(input())
a=[0,]*9
rates=list(map(int,input().split()))
for i in range(N):
    rank=int(rates[i]/400)
    if rank>8:
        rank=8
    a[rank]+=1
variation=0
for i in range(8):
    if a[i] > 0:
        variation+=1
if variation==0:
    print("1 " + str(a[8]))
else:
    print(str(variation)+" "+str(variation+a[8]))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
over = 0
rate = set()
for x in a:
    if 399>=x>=1:
        rate.add(1)
    elif 799>=x>=400:
        rate.add(2)
    elif 1199>=x>=800:
        rate.add(3)
    elif 1599>=x>=1200:
        rate.add(4)
    elif 1999>=x>=1600:
        rate.add(5)
    elif 2399>=x>=2000:
        rate.add(6)
    elif 2799>=x>=2400:
        rate.add(7)
    elif 3199>=x>=2800:
        rate.add(8)
    else:
        over += 1

if len(rate)>0:
    print(len(rate),len(rate)+over)
else:
    print(1,over)

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
a = [int(m) for m in a]
rate = {}
for i in range(9):
    rate[i] = 0
for i in range(n):
    for rank in range(9):
        if rank == 0:
            if 1 <= a[i] <= 400 * (rank + 1) - 1:
                rate[rank] += 1
        if rank == 8:
            if 400 * rank <= a[i]:
                rate[rank] += 1
        elif 400 * rank <= a[i] <= 400 * (rank + 1) - 1:
            rate[rank] += 1
maxco = 0
minco = 0
void = 0
for i in range(9):
    if rate[i] != 0:
        if i == 8:
            if void == 8:
                minco += 1
            maxco += rate[i]
        else:
            maxco += 1
            minco += 1
    else:
        void += 1
print(minco, maxco)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]

color = [0 for i in range(9)]
for i in range(n):
    if a[i] < 3200:
        color[int(a[i] / 400)] = 1
    else:
        color[-1] += 1
# print(color[0:-1])
# print(color)
print("{} {}".format(
    max(sum(color[0:-1]), min(1, color[-1])),
    sum(color[0:-1])+color[-1]))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
col = [0] * 8
red = 0
minn = 0
maxx = 0

for i in A:
    if i <= 399:
        col[0] = 1
    elif i <= 799:
        col[1] = 1
    elif i <= 1199:
        col[2] = 1
    elif i <= 1599:
        col[3] = 1
    elif i <= 1999:
        col[4] = 1
    elif i <= 2399:
        col[5] = 1
    elif i <= 2799:
        col[6] = 1
    elif i <= 3199:
        col[7] = 1
    else:
        red += 1
if red == 0:
    minn = sum(col)
    maxx = sum(col)
elif red >= 1 and sum(col) == 0:
    minn = 1
    maxx = red
else:
    minn = sum(col)
    maxx = sum(col)+red

print(minn, maxx)

Submission status: Accepted

Solution code:
n = int(input())
rate_list = list(map(int, input().split()))
emp_list = [0]*9
for i in range(n):
    if  1 <= rate_list[i] <= 399:
        emp_list[0] = 1
    elif 400 <= rate_list[i] <= 799:
        emp_list[1] = 1
    elif 800 <= rate_list[i] <= 1199:
        emp_list[2] = 1        
    elif 1200 <= rate_list[i] <= 1599:
        emp_list[3] = 1        
    elif 1600 <= rate_list[i] <= 1999:
        emp_list[4] = 1        
    elif 2000 <= rate_list[i] <= 2399:
        emp_list[5] = 1        
    elif 2400 <= rate_list[i] <= 2799:
        emp_list[6] = 1        
    elif 2800 <= rate_list[i] <= 3199:
        emp_list[7] = 1        
    elif 3200 <= rate_list[i]:
        emp_list[8] += 1
sum_ = 0
for i in range(8):
    sum_ += emp_list[i]
if sum_ == 0:
    print(1, end="")
    print(" ")
    print(emp_list[8])
else:
    print(sum_, end="")
    print(" ", end="")
    print(sum_+emp_list[8])

Submission status: Accepted

Solution code:
N=int(input())
C=[0 for i in range(8)]
R=0
a=list(map(int,input().split()))
for i in range(N):
    if int(a[i]/400)<=7:
        C[int(a[i]/400)]=1
    else:
        R+=1
min=max(1,sum(C))
max=sum(C)+R
print(min,max)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
count=[0,0,0,0,0,0,0,0]
change =0
for a in A:
    if a<400:
        count[0] =1
    elif a<800:
        count[1] =1
    elif a<1200:
        count[2] =1
    elif a<1600:
        count[3] =1
    elif a<2000:
        count[4] =1
    elif a<2400:
        count[5] =1
    elif a<2800:
        count[6] =1
    elif a<3200:
        count[7] =1
    else:
        change +=1
Min=max(sum(count),1)
Max=sum(count) + change
print(Min,Max)

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
s=[0]*8
a=0
for i in l:
    if i<400:
        s[0]+=1
    elif i<800:
        s[1]+=1
    elif i<1200:
        s[2]+=1
    elif i<1600:
        s[3]+=1
    elif i<2000:
        s[4]+=1
    elif i<2400:
        s[5]+=1
    elif i<2800:
        s[6]+=1
    elif i<3200:
        s[7]+=1
    else:
        a+=1
#print(s)
b=0
for i in s:
    if i!=0:
        b+=1
print(max(1,b),b+a)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
m = {}
non_color = 0

for a in A:
    if a < 400:  # 1-399
        m[0] = 1
    elif 400 <= a and a < 800:  # 400-799
        m[1] = 1
    elif 800 <= a and a < 1200:  # 800-1199
        m[2] = 1
    elif 1200 <= a and a < 1600:  # 1200-1599
        m[3] = 1
    elif 1600 <= a and a < 2000:  # 1600-1999
        m[4] = 1
    elif 2000 <= a and a < 2400:  # 2000-2399
        m[5] = 1
    elif 2400 <= a and a < 2800:  # 2400-2799
        m[6] = 1
    elif 2800 <= a and a < 3200:  # 2800-3199
        m[7] = 1
    elif 3200 <= a:  # 3200-
        non_color += 1

if non_color > 0:
    print(max(len(m), 1), len(m)+non_color)
else:
    print(len(m), len(m))

Submission status: Accepted

Solution code:
N=int(input())
Participant=[int(i) for i in input().split()]
Point=[0,399,799,1199,1599,1999,2399,2799,3199]
n=0
Colors=0
Any_Colors=0
while n<=len(Point)-2:
  for i in Participant:
    if Point[n]<i<=Point[n+1]:
      Colors+=1
      break
  n+=1
for i in Participant:
  if Point[len(Point)-1]<i:
    Any_Colors+=1
max_Colors=Colors+Any_Colors
if Colors==0 and Any_Colors>0:
  min_Colors=1
elif Colors>0:
  min_Colors=Colors
print(min_Colors,max_Colors)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().strip().split()))
free = 0
col1 = 0
col2 = 0
col3 = 0
col4 = 0
col5 = 0
col6 = 0
col7 = 0
col8 = 0
for i in range(N):
	if a[i] <= 399:
		col1 = 1
	elif a[i] <= 799:
		col2 = 1
	elif a[i] <=1199:
		col3 = 1
	elif a[i] <= 1599:
		col4 = 1
	elif a[i] <= 1999:
		col5 = 1
	elif a[i] <= 2399:
		col6 = 1
	elif a[i] <= 2799:
		col7 = 1
	elif a[i] <= 3199:
		col8 = 1
	else:
		free += 1
#print(col1, col2, col3, col4, col5, col6, col7, col8, free)
colsum = col1 + col2 + col3 + col4 + col5 + col6 + col7 + col8
colmax = colsum + free

if colsum == 0:
	colmin = 1
else:
	colmin = colsum
	  
print(colmin, colmax)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))

baclet = [False] * 9
baclet[8] = 0

for val in a:
    if val < 400:
        baclet[0] = True
    elif val >= 400 and val < 800: 
        baclet[1] = True
    elif val >= 800 and val < 1200: 
        baclet[2] = True
    elif val >= 1200 and val < 1600: 
        baclet[3] = True
    elif val >= 1600 and val < 2000: 
        baclet[4] = True
    elif val >= 2000 and val < 2400: 
        baclet[5] = True
    elif val >= 2400 and val < 2800: 
        baclet[6] = True
    elif val >= 2800 and val < 3200: 
        baclet[7] = True
    elif val >= 3200: 
        baclet[8] += 1

if baclet[:-1].count(True) > 0:
    print(baclet[:-1].count(True),end=" ")
elif baclet[8] > 0:
    print(1,end=" ")

print(baclet[:-1].count(True) + baclet[8])

Submission status: Accepted

Solution code:
N=int(input())
S=input().split()
for i in range(0,N):
    s=int(S[i])
    if 1<=s<=399:
        S[i]="a"
    if 400<=s<=799:
        S[i]="b"
    if 800<=s<=1199:
        S[i]="c"
    if 1200<=s<=1599:
        S[i]="d"
    if 1600<=s<=1999:
        S[i]="e"
    if 2000<=s<=2399:
        S[i]="f"
    if 2400<=s<=2799:
        S[i]="g"
    if 2800<=s<=3199:
        S[i]="h"
    if 3200<=s:
        S[i]="i"

if "i" in S:
    i=S.count("i")
    B=len(set(S))
    if B==1:
        C=1
        D=N
    else:
        C=B-1
        D=C+i
    
else:
    C=len(set(S))
    D=C

print(C,D)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
array1 = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
array2 = [True for _ in range(8)]
result1 = 0
plus = 0

for i in range(N):

    if a[i] >= 3200:
        plus += 1
        continue

    for j in range(8):
        if a[i] < array1[j]:
            if array2[j]:
                result1 += 1
                array2[j] = False
            break

result2 = result1 + plus

print(max(result1, 1), result2)

Submission status: Accepted

Solution code:
a = int(input())
ar = list(map(int,input().split(" ")))
br = []
count = 0
for r in ar:
    if r >= 1 and r <= 399:
        br.append("g")
    elif r >= 400 and r <= 799:
        br.append("b")
    elif r >= 800 and r <= 1199:
        br.append("gr")
    elif r >= 1200 and r <= 1599:
        br.append("w")
    elif r >= 1600 and r <= 1999:
        br.append("bl")
    elif r >= 2000 and r <= 2399:
        br.append("y")
    elif r >= 2400 and r <= 2799:
        br.append("o")
    elif r >= 2800 and r <= 3199:
        br.append("r")
    else:
        count += 1
if len(set(br)) == 0:
    print(1,count)
else:
    print(len(set(br)),len(set(br)) + count)

Submission status: Accepted

Solution code:
# encoding: utf-8
N = int(input())
a = list(map(int, input().split()))

used = 0
rainbow = 0
for ai in a:
    for i in range(8):
        if ai < 400 * (i + 1):
            used = used | (2 ** i)
            break
        else: continue
    else: rainbow += 1

ans = 0
for i in range(8):
    if used & (2 ** i) > 0: ans += 1

print(max(1, ans), ans + rainbow) # oh...

Submission status: Accepted

Solution code:
# 要は全員自由色のパターンを見落としていた
# もし自由色がいて、かつ、固定色が0人の場合、最小のパターンは1
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))


col = []  # boolean
for rate in range(0, 3200, 400):
    if len(A[(rate <= A) & (A < (rate + 400))]) is not 0:
        col.append(True)
    else:
        col.append(False)

jiyu = len(A[(3200 <= A)])  # 自由枠

assert len(col) == 8

# min
mi = sum(col)
# max
ma = mi + jiyu

# 以下を見落としていた
if (mi is 0) and (jiyu is not 0):
    mi = 1

print("{} {}".format(mi, ma))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
mapa = {1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}
el = 0
for i in range(n):
    if a[i] < 400:
        mapa[1] += 1
    elif a[i] < 800:
        mapa[2] += 1
    elif a[i] < 1200:
        mapa[3] += 1
    elif a[i] < 1600:
        mapa[4] += 1
    elif a[i] < 2000:
        mapa[5] += 1
    elif a[i] < 2400:
        mapa[6] += 1
    elif a[i] < 2800:
        mapa[7] += 1
    elif a[i] < 3200:
        mapa[8] += 1
    else:
        el += 1
count = 0
for i in mapa:
    if mapa[i] > 0:
        count += 1
if count > 0:
    print(str(count) + ' ' + str(count + el))
else:
    print('1 ' + str(el))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().strip().split()))
ans=[0]*9
for i in range(n):
    if 1<=a[i] and a[i]<=399:
        ans[0]=1
    elif 400<=a[i] and a[i]<=799:
        ans[1]=1
    elif 800<=a[i] and a[i]<=1199:
        ans[2]=1
    elif 1200<=a[i] and a[i]<=1599:
        ans[3]=1
    elif 1600<=a[i] and a[i]<=1999:
        ans[4]=1
    elif 2000<=a[i] and a[i]<=2399:
        ans[5]=1
    elif 2400<=a[i] and a[i]<=2799:
        ans[6]=1
    elif 2800<=a[i] and a[i]<=3199:
        ans[7]=1
    elif 3200<=a[i]:
        ans[8]+=1

if sum(ans[0:8])==0:
    mi=1
else:
    mi=0
    
print("{} {}".format(sum(ans[0:8])+mi,sum(ans)))

Submission status: Accepted

Solution code:
N = input()
a = list(map(int,input().split()))
over3200 = 0
syurui_min = 0
syurui_max = 0
b = [0] * 8
for i in a:
    if 3200 <= i and i <= 4800:
        over3200 += 1
    else:
        b[i // 400] = 1
for i in b:
    if(i == 1):
        syurui_min += 1
syurui_max = syurui_min + over3200
if syurui_min == 0:
    syurui_min = 1
print("{0} {1}".format(syurui_min, syurui_max))

Submission status: Accepted

Solution code:
N = input()
a = list(map(int,input().split()))
over3200 = 0
syurui_min = 0
syurui_max = 0
b = [0] * 8
for i in a:
    if 1 <= i and i <= 399:
        b[0] = 1
    if 400 <= i and i <= 799:
        b[1] = 1
    if 800 <= i and i <= 1199:
        b[2] = 1
    if 1200 <= i and i <= 1599:
        b[3] = 1
    if 1600 <= i and i <= 1999:
        b[4] = 1
    if 2000 <= i and i <= 2399:
        b[5] = 1
    if 2400 <= i and i <= 2799:
        b[6] = 1
    if 2800 <= i and i <= 3199:
        b[7] = 1
    if 3200 <= i and i <= 4800:
        over3200 += 1
for i in b:
    if(i == 1):
        syurui_min += 1
syurui_max = syurui_min + over3200
if syurui_min == 0:
    syurui_min = 1
print("{0} {1}".format(syurui_min, syurui_max))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

rates = [0]*9
for i in range(n):
  r = min(a[i]//400, 8)
  rates[r] += 1

n_min, n_max = 0, 0
if max(rates[:-1]) > 0:
  for i in range(8):
    n_min += 1 if rates[i] > 0 else 0
  n_max = n_min+rates[-1]
else:
  n_min = 1
  n_max = rates[-1]

print(n_min, n_max)

Submission status: Accepted

Solution code:
import sys
def color(x):
  if x<400:return('灰')
  elif 399<x<800:return('茶')
  elif 799<x<1200:return('緑')
  elif 1199<x<1600:return('水')
  elif 1599<x<2000:return('青')
  elif 1999<x<2400:return('黄')
  elif 2399<x<2800:return('橙')
  elif 2799<x<3200:return('赤')
  else:return('*')
input()
l=list(map(int,input().split()))
l=[color(i) for i in l]
v=l.count('*')
c=v==len(l)
l=len(set(l))
if v==0:
  print(' '.join([str(l)]*2))
  sys.exit()
else:
  if c:v-=1
  else:l-=1
  print(l,end=' ')
print(l+v)