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:
a=[0]*9;input()
for x in input().split():
    x=int(x)
    if x<3200:a[x//400]=1
    else:a[8]+=1
b=sum(a[:8]);print(max(b,1),b+a[8])

Submission status: Accepted

Solution code:
input();a=[0]*9
for x in input().split():
    x=int(x)
    if x>3599:x=3200
    a[x//400]+=1
b=sum([1 if x else 0 for x in a[:8]])
print(max(1,b),b+a[8])

Submission status: Accepted

Solution code:
def c_colorful_leaderboard(N, A):
    from collections import defaultdict
    rating_list = defaultdict(int)
    rating_color = ['gray', 'brown', 'green',
                    'skyblue', 'blue', 'yellow', 'orange', 'red']  # AtCoderのレート色
    other = 0  # レート3200以上の選手の数
    for rating in A:
        r = rating // 400  # レート色は400刻みで変わるため
        if r >= 8:  # レート3200位上
            other += 1
        else:
            rating_list[rating_color[r]] += 1
    ans = '{} {}'.format(max(1, len(rating_list)), len(rating_list) + other)
    return ans

N=int(input())
A=[int(i) for i in input().split()]
print(c_colorful_leaderboard(N, A))

Submission status: Accepted

Solution code:
import collections
n = int(input())
a = list(map(int,input().split()))
ub = collections.defaultdict(int)
ub[8] = 0
lb = set()
for x in a:
    lb.add(min(x,2800)//400)
    ub[min(x,3200)//400] += 1;
print(len(lb),len(ub)+ub[8]-1)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
b =[]
countmax = 0
countmin = 0

for i in range(n):
    b.append(a[i]//400)
for i in range(13):
    if b.count(i) >=1:
        if i<= 7:
            countmax +=1
            countmin +=1
        else:
            countmax += b.count(i)
print(max(1,countmin),countmax)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
S,red = set([]),0
for i in range(N):
    rank = A[i]//400
    if rank < 8:
        S.add(rank)
    else:
        red += 1
print(max(1,len(S)),len(S)+red)

Submission status: Accepted

Solution code:
N=int(input())
t,n,u=[],0,0
for s in list(map(int,input().split())):
    for i in range(8):
        if 0+400*i<=s<=399+400*i:
            t.append(i)
            break
    else:
        n+=1
l=len(set(t))
if l==0:
    u=1
print(str(l+u)+" "+str(l+n))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
s=set()
non=0
for x in a:
    tmp=x//400
    if tmp<8:
        s.add(tmp)
    else:
        non+=1
print(max(1,len(s)),len(s)+non)

Submission status: Accepted

Solution code:
def color(rating):
    d = {'gray': (1, 399), \
         'brown': (400, 799), \
         'green': (800, 1199), \
         'cyan': (1200, 1599), \
         'blue': (1600, 1999), \
         'yellow': (2000, 2399), \
         'orange': (2400, 2799), \
         'red': (2800, 3199), \
         'any': (3200, 4800)}
    for k, v in d.items():
        if rating >= v[0] and rating <= v[1]:
            return k

def count(colors):
    different_colors = set(colors)
    num_colors = len(different_colors) - ('any' in different_colors)
    anys = colors.count('any')
    if num_colors == 0 and anys > 0:
        minimum = 1
    else:
        minimum = num_colors
    maximum = num_colors + anys
    return (minimum, maximum)


if __name__ == '__main__':
    _ = input()
    ratings = map(int, input().split())
    colors = list(map(lambda x: color(x), ratings))
    minimum, maximum = count(colors)
    print(minimum, maximum)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(4800//400 + 1)]
for i in a:
    b[i//400] += 1;
t = 0
ans = 0
for i in range(4800//400 + 1):
    if b[i] > 0:
        if i < 3200//400:
            ans+=1
        else:
            t+=b[i]
if ans > 0:
    print(ans,t+ans)
else:
    print(1,t)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(lambda x : int(x) // 400, input().split()))
over3200 = sum(list(map(lambda x: 1 if x >= 8 else 0, a)))

count = 0
for i in range(8):
    if i in a:
        count += 1

print(max(1, count), count+over3200)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(lambda x : int(x) // 400, input().split()))
over3200 = sum(list(map(lambda x: 1 if x >= 8 else 0, a)))

count = 0
for i in range(8):
    if i in a:
        count += 1
        
print(max(1, count), count+over3200)

Submission status: Accepted

Solution code:
n = int(input())
a = [0] * 8
b = 0
for x in input().split():
    x = int(x)
    if x >= 3200: b += 1
    else: a[x//400] += 1
m = 0
for x in a:
    if x > 0: m += 1
print(max(m, 1), m + b)

Submission status: Accepted

Solution code:
n=int(input())
mark=[i for i in range(0,3200,400)]
mark.append(99999999999999)
def color(x):
    for i in range(9):
        if mark[i]<=x<mark[i+1]:
            return i     
score=list(map(int,input().split()))
set=set()
special=0
for x in score:
    if x<3200:
        set.add(color(x))
    else:
        special+=1
        
print(max(len(set),1),len(set)+special)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
x,y = set(),0
for i in a:
	num = (i-i%400)//400
	if num>=8:
		y += 1
	x.add(min(num,8))
if len(x) != 1:
	if 8 in x:
		x.remove(8)
	print(len(x),len(x)+y)
else:
	if 8 in x: print(1,y)
	else: print(1,1)

Submission status: Accepted

Solution code:
n=int(input())
l=[int(i) for i in input().split()]
cnt=[0]*9
ans=0
for i in l:
    if i>3199:
        i=3200
    cnt[i//400]+=1
for p in range(8):
    i=cnt[p]
    if i!=0:
        ans+=1
print(ans if ans!=0 else 1,ans+cnt[-1])

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
c=[0,0,0,0,0,0,0,0]
f=0
for i in a:
  if i//400<8:
    c[i//400]=1
  else:
    f+=1
ans=0
for i in c:
  ans+=i
print(max(1,ans),ans+f)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
rate = [0 for i in range(9)]
ans = 0

for i in range(n):
    if 1<=a[i] and a[i]<=399:
        rate[0] = 1
    elif 400<=a[i] and a[i]<=799:
        rate[1] = 1
    elif 800<=a[i] and a[i]<=1199:
        rate[2] = 1
    elif 1200<=a[i] and a[i]<=1599:
        rate[3] = 1
    elif 1600<=a[i] and a[i]<=1999:
        rate[4] = 1
    elif 2000<=a[i] and a[i]<=2399:
        rate[5] = 1
    elif 2400<=a[i] and a[i]<=2799:
        rate[6] = 1
    elif 2800<=a[i] and a[i]<=3199:
        rate[7] = 1
    else:
        rate[8] += 1

for i in range(len(rate)-1):
    if rate[i] == 1:
        ans += 1
if ans == 0:
    ans = 1
    rate[8] -= 1
print(ans,ans+rate[8])

Submission status: Accepted

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

ans=0
over=0
for rate in a:
	if rate<3200:
		num[int(rate/400)]=True
	else:
		over+=1
for flag in num:
	if flag:
		ans+=1

print(max(ans,1),end="")
print(" ",end="")
print(ans+over)

Submission status: Accepted

Solution code:
import math
n = int(input())
lis = []
cou = 0
li = list(map(int,input().split()))
for i in range(n):
    if li[i] >= 3200:
        cou += 1
    else:
        if math.floor(li[i] // 400) not in lis:
            lis.append(li[i] // 400)
if len(lis) == 0:
    print(1,min(len(lis) + cou,8))
else:
    print(len(lis),min(n,len(lis) + cou))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
s=set()
fr=0
for i in a:
  x=i//400
  if(x<8):s.add(x)
  else:fr+=1
ki=len(s)
ma=ki+fr
mi=max(ki,1)
print(mi,ma)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
ash=0
brown=0
green=0
lightblue=0
blue=0
yellow=0
orange=0
red=0
ans=0
for i in a:
    if i<=399:
        if ash==0:
            ash+=1
    elif 400<=i<=799:
        if brown==0:
            brown+=1
    elif 800<=i<=1199:
        if green==0:
            green+=1
    elif 1200<=i<=1599:
        if lightblue==0:
            lightblue+=1
    elif 1600<=i<=1999:
        if blue==0:
            blue+=1
    elif 2000<=i<=2399:
        if yellow==0:
            yellow+=1
    elif 2400<=i<=2799:
        if orange==0:
            orange+=1
    elif 2800<=i<=3199:
        if red==0:
            red+=1
    else:
        ans+=1
v=ash+brown+green+lightblue+blue+yellow+orange+red
if v==0:
    print(1,ans)
else:
    print(v,v+ans)

Submission status: Accepted

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

dic = {'gray':0,'brown':0,'green':0,'light blue':0,'blue':0,'yellow':0,'orange':0,'red':0}
more = 0
for a in A:
    if 399 >= a >= 1 :
        dic['gray'] += 1
    elif 799 >= a >= 400:
        dic['brown'] += 1
    elif 1199 >= a >= 800:
        dic['green'] += 1
    elif 1599 >= a >= 1200:
        dic['light blue'] += 1
    elif 1999 >= a >= 1600:
        dic['blue'] += 1
    elif 2399 >= a >= 2000:
        dic['yellow'] += 1
    elif 2799 >= a >= 2400:
        dic['orange'] += 1
    elif 3199 >= a >= 2800:
        dic['red'] += 1
    else:
        more += 1
        
cnt = 0        
for i in dic.keys():
    if dic[i] != 0:
        cnt += 1
if cnt != 0:
    c_max = cnt + more
    c_min = cnt
else:
    c_max = more
    c_min = min(1,more)
print(c_min,c_max)

Submission status: Accepted

Solution code:
import math
n=input()
a= [min(math.floor(int(i)//400),8) for i in input().split()]
a7= len(set([i for i in a if i<=7]))
a8= len([i for i in a if i==8])
print(max(a7,1),a7+a8)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
color=[]
count=int(0)
for i in range(9):
    color.append(0)
for i in range(n):
    if 1<=a[i]<400:
        color[0]+=1
    elif 400<=a[i]<800:
        color[1]+=1
    elif 800<=a[i]<1200:
        color[2]+=1
    elif 1200<=a[i]<1600:
        color[3]+=1
    elif 1600<=a[i]<2000:
        color[4]+=1
    elif 2000<=a[i]<2400:
        color[5]+=1
    elif 2400<=a[i]<2800:
        color[6]+=1
    elif 2800<=a[i]<3200:
        color[7]+=1
    elif 3200<=a[i]:
        color[8]+=1
for i in range(8):
    if color[i]!=0:
        count+=1
high=int(0)
low=int(0)
high=max(count,count+color[8])
if count>=1:
    low=count
elif count==0:
    low=1
print(low,high)

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    A = list(map(int, input().split(" ")))
    colors = [False] * 8
    meta = 0
    for a in A:
        if 1 <= a <= 399:
            colors[0] = True
        elif 400 <= a <= 799:
            colors[1] = True
        elif 800 <= a <= 1199:
            colors[2] = True
        elif 1200 <= a <= 1599:
            colors[3] = True
        elif 1600 <= a <= 1999:
            colors[4] = True
        elif 2000 <= a <= 2399:
            colors[5] = True
        elif 2400 <= a <= 2799:
            colors[6] = True
        elif 2800 <= a <= 3199:
            colors[7] = True
        else:
            meta += 1

    cnt = 0
    for c in colors:
        if c == True:
            cnt += 1

    print(max(1, cnt), cnt + meta)


solve()

Submission status: Accepted

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

free = 0
arr = [0] * 8

for i in a:
	limit = 400
	while (limit <= 3200):
		if i < limit:
			arr[(limit // 400)-1] +=  1
			break
		else:
			limit += 400

	if limit== 3600:
		free += 1

color =  0
for i in arr:
	if i > 0:
		color += 1


print(str(max(1,color)) + " " + str(color + free))

Submission status: Accepted

Solution code:
def c_ColorfulLeaderboard(N, A):
    from collections import defaultdict
    color = defaultdict(int)
    other = 0  # レート3200以上の選手の数
    for a in A:
        if 1 <= a <= 399:
            color['gray'] += 1
        elif 400 <= a <= 799:
            color['brown'] += 1
        elif 800 <= a <= 1199:
            color['green'] += 1
        elif 1200 <= a <= 1599:
            color['skyblue'] += 1
        elif 1600 <= a <= 1999:
            color['blue'] += 1
        elif 2000 <= a <= 2399:
            color['yellow'] += 1
        elif 2400 <= a <= 2799:
            color['orange'] += 1
        elif 2800 <= a <= 3199:
            color['red'] += 1
        elif 3200 <= a:
            other += 1
    # => 2 2,3 5,1 1
    return '{} {}'.format(max(1, len(color)), len(color) + other)

N=int(input())
A=[int(i) for i in input().split()]
print(c_ColorfulLeaderboard(N, A))

Submission status: Accepted

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

min_cnt = set()
max_cnt = set()

rename = -1
for x in xs:
    if x >= 3200:
        max_cnt.add(rename)
        rename -= 1
    else:
        max_cnt.add(x//400)
        min_cnt.add(x//400)

print(max(1, len(min_cnt)), len(max_cnt))

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
color = [0] * 9

for i in range(N):
    if P[i] >= 3200:
        color[8] += 1
    elif 3200 > P[i] >= 2800:
        color[7] += 1
    elif 2800 > P[i] >= 2400:
        color[6] += 1
    elif 2400 > P[i] >= 2000:
        color[5] += 1
    elif 2000 > P[i] >= 1600:
        color[4] += 1
    elif 1600 > P[i] >= 1200:
        color[3] += 1
    elif 1200 > P[i] >= 800:
        color[2] += 1
    elif 800 > P[i] >= 400:
        color[1] += 1
    elif 400 > P[i]:
        color[0] += 1

if color[8] != 0 and color.count(0) == 8:
    ans1 = 1
    ans2 = color[8]
elif color[8] == 0:
    ans1 = 9 - color.count(0)
    ans2 = ans1 + color[8]
else:
    ans1 = 9 - color.count(0) - 1
    ans2 = ans1 + color[8]

print(ans1, ans2)

Submission status: Accepted

Solution code:
N=int(input())

S=list(map(int, input().split()))

T=[0]*9
for i in range(N):
    if S[i] < 400:
        T[0]+=1
    elif S[i] < 800:
        T[1]+=1
    elif S[i] < 1200:
        T[2]+=1
    elif S[i] < 1600:
        T[3]+=1
    elif S[i] < 2000:
        T[4]+=1
    elif S[i] < 2400:
        T[5]+=1
    elif S[i] < 2800:
        T[6]+=1
    elif S[i] < 3200:
        T[7]+=1
    elif S[i] >= 3200:
        T[8]+=1

K=0
for i in range(8):
    if T[i] >= 1:
        K+=1

if K>0:
    print(K,K+T[8])
else:
    print(1,T[8])

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))
found = set()
f = 0
for i in l:
  if i <= 399:
    found.add("灰色")
  elif i <= 799:
    found.add("茶色")
  elif i <= 1199:
    found.add("緑色")
  elif i <= 1599:
    found.add("水色")
  elif i <= 1999:
    found.add("青色")
  elif i <= 2399:
    found.add("黄色")
  elif i <= 2799:
    found.add("橙色")
  elif i <= 3199:
    found.add("赤色")
  else:
    f += 1
if len(found) == 0:
  print(1, min(f, 8))
else:
  print(len(found), len(found) + f)

Submission status: Accepted

Solution code:
ignore = input()
l = map(int, raw_input().split())
temp = []
counter = 0
if ignore == 1:
    print 1, 1
    exit()
for i in range(len(l)):
    if (1 <= l[i] <= 399) and ("Grey" not in temp):
        temp.append("Grey")
    elif (400 <= l[i] <= 799) and ("Brown" not in temp):
        temp.append("Brown")
    elif (800 <= l[i] <= 1199) and ("Green" not in temp):
        temp.append("Green")
    elif (1200 <= l[i] <= 1599) and ("Water" not in temp):
        temp.append("Water")
    elif (1600 <= l[i] <= 1999) and ("Blue" not in temp):
        temp.append("Blue")
    elif (2000 <= l[i] <= 2399) and ("Yellow" not in temp):
        temp.append("Yellow")
    elif (2400 <= l[i] <= 2799) and ("Turq" not in temp):
        temp.append("Turq")
    elif (2800 <= l[i] <= 3199) and ("Red" not in temp):
        temp.append("Red")
    elif (l[i] >= 3200):
        counter+=1
if counter == 0:
    print len(temp), len(temp)
elif len(temp) == 0:
    print 1 , (len(temp) + counter)
else:
    print len(temp), (len(temp) + counter)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
con = 0
var = 0
count = [1, 1, 1, 1, 1, 1, 1, 1]

for i in a:
    if(i < 400):
        con += count[0]
        count[0] = 0
    elif(i < 800):
        con += count[1]
        count[1] = 0
    elif(i < 1200):
        con += count[2]
        count[2] = 0
    elif(i < 1600):
        con += count[3]
        count[3] = 0
    elif(i < 2000):
        con += count[4]
        count[4] = 0
    elif(i < 2400):
        con += count[5]
        count[5] = 0
    elif(i < 2800):
        con += count[6]
        count[6] = 0
    elif(i < 3200):
        con += count[7]
        count[7] = 0
    else:
        var += 1

if(con > 0):
    print(con, con+var)
else:
    print(1, var)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
ans = set()
other = 0
 
for i in a:
    if i <400:
        ans.add("gray")
    elif i <800:
        ans.add("green")
    elif i < 1200:
        ans.add("brown")
    elif i <1600:
        ans.add("light_blue")
    elif i<2000:
        ans.add("blue")
    elif i<2400:
        ans.add("yellow")
    elif i <2800:
        ans.add("orange")
    elif i <3200:
        ans.add("red")
    else:
        other += 1
 
color = len(ans)
if other == N:
    print(1," ",min(other,8))
else:
    print(color, " " ,min(N,color +other))

Submission status: Accepted

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

color=[0]*9

for a in A:
	if a < 400:
		color[0] = 1
	elif a < 800:
		color[1] = 1
	elif a < 1200:
		color[2] = 1
	elif a < 1600:
		color[3] = 1
	elif a < 2000:
		color[4] = 1
	elif a < 2400:
		color[5] = 1
	elif a < 2800:
		color[6] = 1
	elif a < 3200:
		color[7] = 1
	else:
		color[8] += 1

label=0
for i in range(8):
	label += color[i]

minres = max(label,1)
maxres = label + color[8]

print(minres, maxres)

Submission status: Accepted

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

def labeling(A):
    # ラベル数は9
    label = [0] * 9
    
    for i in A:
        if (0 <= i) and (i < 400):
            label[0] += 1
        elif (400 <= i) and (i < 800):
            label[1] += 1
        elif (800 <= i) and (i < 1200):
            label[2] += 1
        elif (1200 <= i) and (i < 1600):
            label[3] += 1
        elif (1600 <= i) and (i < 2000):
            label[4] += 1
        elif (2000 <= i) and (i < 2400):
            label[5] += 1
        elif (2400 <= i) and (i < 2800):
            label[6] += 1
        elif (2800 <= i) and (i < 3200):
            label[7] += 1
        else:
            label[8] += 1

    return label

label = labeling(A)
label_number = 0

for i in range(len(label)-1):
    if label[i] > 0:
        label_number += 1

print(max(label_number, 1), min(100000000000, (label_number+label[-1])))

Submission status: Accepted

Solution code:
from sys import stdin, stdout


def readLine_int_list(): return list(map(int, stdin.readline().split()))


def main():
    n = input()
    a = readLine_int_list()

    c = []
    _c = []

    for i in a:
        rank = i // 400
        if rank > 7:
            _c.append(rank)
        else:
            c.append(rank)

    p = len(set(c))
    print(max(1, p), p + len(_c))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
a = Counter([min(int(ai) // 400, 8) for ai in input().split()])
tmp = sum(bool(a[i]) for i in range(8))
print(max(1, tmp), tmp + a[8])

Submission status: Accepted

Solution code:
#!/usr/bin/env python
#-*- coding: utf-8 -*-

from collections import defaultdict
from math import factorial as f
from fractions import gcd as g

N = int (raw_input ())
l = [int (i) for i in raw_input ().split ()]

d = defaultdict (int)
c = 0
for i in l:
    if i < 400: d ["gray"] += 1
    elif i < 800: d ["brown"] += 1
    elif i < 1200: d ["green"] += 1
    elif i < 1600: d ["cyan"] += 1
    elif i < 2000: d ["blue"] += 1
    elif i < 2400: d ["yellow"] += 1
    elif i < 2800: d ["orange"] += 1
    elif i < 3200: d ["red"] += 1
    else: c += 1

print max (1, len (d.keys ())), len (d.keys ()) + c

Submission status: Accepted

Solution code:
n = int(input())
aa = [min(8, int(a) // 400) for a in input().split()]
over3200 = aa.count(8)
colors = len(set(aa))
_min = colors - 1 if over3200 and n > over3200 else colors
_max = colors + over3200 - 1 if over3200 else colors
print(_min, _max)

Submission status: Accepted

Solution code:
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))


def main():
    n = input()
    a = readLine_int_list()

    c = []
    _c = [] 

    for i in a:
        rank = i//400
        if rank > 7:
           _c.append(rank) 
        else:    
            c.append(rank)
    
    
    p = len(set(c))
    print(max(1,p), p+len(_c))

        
if __name__ == "__main__":
    main()

Submission status: Accepted

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

border = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]

ret = 0
for i in range(len(border) - 1):
    if len(list(filter(lambda n: border[i] <= n < border[i + 1], A))) > 0:
        ret += 1
print(max(1, ret), ret + len(list(filter(lambda n: 3200 <= n, A))))

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
ans = set()
other = 0

for i in a:
    if i <400:
        ans.add("gray")
    elif i <800:
        ans.add("green")
    elif i < 1200:
        ans.add("brown")
    elif i <1600:
        ans.add("light_blue")
    elif i<2000:
        ans.add("blue")
    elif i<2400:
        ans.add("yellow")
    elif i <2800:
        ans.add("orange")
    elif i <3200:
        ans.add("red")
    else:
        other += 1

color = len(ans)
if other == N:
    print(1," ",min(other,8))
else:
    print(color, " " ,min(N,color +other))

Submission status: Accepted

Solution code:
n = input()
a = map(int, raw_input().split())
color = [0 for _ in range(9)]
for item in a:
    i = item / 400
    i = min(i, 8)
    color[i] += 1

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

min_ans = max(ans, 1)
max_ans = ans + color[8]
#max_ans = min(max_ans, 8)

print min_ans, max_ans

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://abc064.contest.atcoder.jp/tasks/abc064_c

"""
import sys
from sys import stdin
from collections import defaultdict
input = stdin.readline


def get_color(s):
    ans = 'any'
    if s < 400:
        ans = 'gray'
    elif s < 800:
        ans = 'brown'
    elif s < 1200:
        ans = 'green'
    elif s < 1600:
        ans = 'light blue'
    elif s < 2000:
        ans = 'blue'
    elif s < 2400:
        ans = 'yellow'
    elif s < 2800:
        ans = 'orange'
    elif s < 3200:
        ans = 'red'
    return ans


def main(args):
    N = int(input())
    scores = [int(x) for x in input().split()]

    colors = defaultdict(int)
    for s in scores:
        res = get_color(s)
        colors[res] += 1

    normal_color = 0
    for k, v in colors.items():
        if k != 'any':
            normal_color += 1
    any_color = colors['any']

    print(max(1, normal_color), normal_color + any_color)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
b = {}
b['gray'] = 0
b['brown'] = 0
b['green'] = 0
b['cyan'] = 0
b['blue'] = 0
b['yellow'] = 0
b['orange'] = 0
b['red'] = 0
b['other'] = 0

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

for ai in a:
    if ai < 400:
        b['gray'] += 1
    elif ai < 800:
        b['brown'] += 1
    elif ai < 1200:
        b['green'] += 1
    elif ai < 1600:
        b['cyan'] += 1
    elif ai < 2000:
        b['blue'] += 1
    elif ai < 2400:
        b['yellow'] += 1
    elif ai < 2800:
        b['orange'] += 1
    elif ai < 3200:
        b['red'] += 1
    else:
        b['other'] += 1

ans = 0
for k, v in b.items():
    if k != 'other' and v > 0:
        ans += 1

if ans == 0:
    print(1, b['other'])
else:
    print(ans, ans + b['other'])

Submission status: Accepted

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

rating = [0 for i in range(9)]
for aa in a:
    if aa <= 3199:
        rating[aa // 400] += 1
    else:
        rating[8] += 1

ans_min = 0
for i in range(8):
    if rating[i] > 0:
        ans_min += 1

ans_max = ans_min + rating[8]

ans_min = max(ans_min, 1)

print(ans_min, ans_max)

Submission status: Accepted

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
rank = [0]*9
ans = [0]*2
for i in range(len(a)):
    if a[i] < 400:
        rank[0] = 1
    elif a[i] < 800:
        rank[1] = 1
    elif a[i] < 1200:
        rank[2] = 1
    elif a[i] < 1600:
        rank[3] = 1
    elif a[i] < 2000:
        rank[4] = 1
    elif a[i] < 2400:
        rank[5] = 1
    elif a[i] < 2800:
        rank[6] = 1
    elif a[i] < 3200:
        rank[7] = 1
    else:
        rank[8] += 1
ans[0] = sum(rank)

if sum(rank[:8]) == 0:
    ans[1] = 1
else:
    ans[1] = sum(rank[:8])

[print(ans[i], end=' ') for i in reversed(range(len(ans)))]

Submission status: Accepted

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

l = [0] * 9
for i in a:
    if i <= 399:
        l[0]=1
    elif i<=799:
        l[1]=1
    elif i<=1199:
        l[2]=1
    elif i<=1599:
        l[3]=1
    elif i<=1999:
        l[4]=1
    elif i<=2399:
        l[5]=1
    elif i<=2799:
        l[6]=1
    elif i<=3199:
        l[7]=1
    else:
        l[8] += 1
if sum(l[:8])==0:
    print(1, l[8])
else:
    print(sum(l[:8]), sum(l))

Submission status: Accepted

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

b = 0
c = set()
for i in range(n):
    if a[i] > 7:
        b += 1
    else:
        c.add(a[i])

print(max(1, len(c)), len(c)+b)

Submission status: Accepted

Solution code:
n=int(input())
pr=list(map(int,input().split()))
rate_color=[]
suge=0
for i in range(n):
    if pr[i]>=3200:
        suge+=1
pr=[x for x in pr if x<=3199]

def cl(x):
    if x<=399:
        return [0]
    elif 400<=x<=799:
        return [1]
    elif 800 <=x<=1199:
        return [2]
    elif 1200 <=x<=1599:
        return [3]
    elif 1600<=x<= 1999:
        return [4]
    elif 2000 <=x<=2399:
        return [5]
    elif 2400 <=x<=2799:
        return [6]
    elif 2800 <=x<=3199:
        return [7]

for i in range(len(pr)):
    x=pr[i]
    rate_color+=cl(x)
color=list(set(rate_color))
color_num=len(color)


max_num=color_num+suge
if color_num==0:
    mini_num=1
else:
    mini_num=color_num
print(mini_num,max_num)

Submission status: Accepted

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

sep = 400
flag = [False]*8
c = 0
for a in A:
    s = a//sep
    if s >= 8:
        c += 1
    else:
        flag[s] = True

min = flag.count(True)
max = min + c
if min == 0:
    min = 1
print("{0} {1}".format(min,max))

Submission status: Accepted

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

    rate_list = [0 for i in range(9)]

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

    if 1 in rate_list[:-1]: minv = sum(rate_list[:-1])
    else: minv = 1

    print("{} {}".format(minv, sum(rate_list)))
    

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N=int(input())
a_n=[int(x) for x in input().split()]
import sys

r=[]
r.append([i for i in a_n if 1<=i<=399])
r.append([i for i in a_n if 400<=i<=799])
r.append([i for i in a_n if 800<=i<=1199])
r.append([i for i in a_n if 1200<=i<=1599])
r.append([i for i in a_n if 1600<=i<=1999])
r.append([i for i in a_n if 2000<=i<=2399])
r.append([i for i in a_n if 2400<=i<=2799])
r.append([i for i in a_n if 2800<=i<=3199])
R=[i for i in a_n if 3200<=i]

count=0
for i in range(len(r)):
    if r[i]:
        count+=1
if count==0:
    count+=1
    print(str(count), str((count-1) + len(R)))
    sys.exit()

print(str(count), str(count+len(R)))

Submission status: Accepted

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

color_list = []
anycolor = 0
for rate in a:
    if(rate >= 3200):
        anycolor+=1
        continue
    color = rate // 400
    if(color not in color_list):
        color_list.append(color)

minc = max(1, len(color_list))
maxc = len(color_list) + anycolor

print(minc, maxc)