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(map(int,input().split()))

ans=[0]*8
count=0
for i in range(n):
    if 8<=a[i]//400:
        count+=1
    else:
        ans[a[i]//400]=1
#print(ans)
if sum(ans)==0:
    print(1,min(8,count))
else:
    print(sum(ans),sum(ans)+count)

Submission status: Accepted

Solution code:
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce
import sys
sys.setrecursionlimit(4100000)

n = int(input())
a = list(map(int, input().split()))
c = [0] * 8
cnt = 0
for i in a:
    if i < 3200:
        c[i // 400] = 1
    else:
       cnt += 1
# print(c)
min_ans = sum(c)
max_ans = min_ans + cnt
# print(c, cnt)
if min_ans == 0:
    print(1, cnt)
else:
    print(min_ans, max_ans)

Submission status: Accepted

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

min_color = 0
for i in range(len(lis)-1):
    if lis[i]>0: min_color+=1
max_color = min_color + lis[-1]
if min_color ==0:
    print(1,max_color)
else:
    print(min_color,max_color)

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
c=[0]*8
sum=0
tmp=0

for i in a:
    n=int(i/400)
    if(i<3200 and c[n]==0):
        c[n]+=1
        sum+=1
    elif(i>=3200):
        tmp+=1
print(sum if sum!=0 else sum+1,sum+tmp)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
i=0
check=[0]*8
while i<n and a[i]<3200:
    a_i=a[i]
    for j in range(8):
        if check[j]==0 and a_i>=400*j and a_i<400*(j+1):
            check[j]=1
            break
    i+=1
if sum(check)==0:
    ans_min=1
    ans_max=n
else:
    ans_min=sum(check)
    ans_max=ans_min+n-i
print(ans_min,ans_max)

Submission status: Accepted

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

c = 0
for i in A: c += 1 if i<3200 else 0
Am = set()
for i in A:
    if i<3200:
        Am.add(i//400)

minc = len(Am) if c>0 else len(Am)+1

AM = set([int(v)//400 if v<3200 else i+50 for i, v in enumerate(A)])
maxc = len(AM)

print(minc, maxc)

Submission status: Accepted

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

lst2 = [0]*9

for i in range(n):
    for j in range(8):
        if lst1[i] < 400*(j+1):
            lst2[j] += 1
            break
    if lst1[i] >= 3200:
        lst2[8] += 1

ans = 0
for i in range(8):
    if lst2[i]:
        ans += 1

print(max(1,ans))
print(ans+lst2[8])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
lis = [0]*8
fr = 0
for i in a:
    col = i // 400
    if col > 7:
        fr += 1
    else:
        lis[col] = 1
mi = max(lis.count(1),1)
mx = lis.count(1) + fr

print(mi,mx)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A.sort()
dic = {1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0}
count = 0
for a in A:
  if a < 400:
    dic[1] += 1
  elif 400 <= a < 800:
    dic[2] += 1
  elif 800 <= a < 1200:
    dic[3] += 1
  elif 1200 <= a < 1600:
    dic[4] += 1
  elif 1600 <= a < 2000:
    dic[5] += 1
  elif 2000 <= a < 2400:
    dic[6] += 1
  elif 2400 <= a < 2800:
    dic[7] += 1
  elif 2800 <= a < 3200:
    dic[8] += 1
  else:
    count += 1
total = 0
for i in range(1, 9):
  if dic[i] != 0:
    total += 1
m = total + count
if total == 0:
  print(1, m)
else:
  print(total, m)

Submission status: Accepted

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

l=[0]*9

for i in range(n):
  if a[i]<400:
    l[0]="t"
  elif a[i]<800:
    l[1]="t"
  elif a[i]<1200:
    l[2]="t"
  elif a[i]<1600:
    l[3]="t"
  elif a[i]<2000:
    l[4]="t"
  elif a[i]<2400:
    l[5]="t"
  elif a[i]<2800:
    l[6]="t"
  elif a[i]<3200:
    l[7]="t"
  else:
    l[8]+=1
countt=l.count("t")

if l[8]==0:
  print(countt,countt)
else:
  print(max(countt,1),countt+l[8])

Submission status: Accepted

Solution code:
n = int(input())
al = list(map(int, input().split()))
count = [0] * 8
overred = 0

for a in al:
    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:
        overred += 1

color = 8 - count.count(0)

if color != 0:
    color_min = color
    color_max = color_min + overred
else:
    color_min = 1
    color_max = overred

print(color_min, color_max)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
d = {}
e = 0
for ai in a:
  s = ai // 400
  if s > 7:
    e += 1
  else:
    if s in d:
      d[s] += 1
    else:
      d[s] = 1
print(max(1, len(d)), len(d) + e)

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int,input().split()))
ans = [0]*9

for i in l:
  x = i//400
  if x >= 8:
    ans[8] += 1
  else:
    ans[x] += 1
count = 0
for i in range(8):
  if ans[i] > 0:
    count += 1
if ans[8]==0:
  print(count,count)
else:
  if count != 0:
    print(count,count+ans[8])
  else:
    print(1,ans[8])

Submission status: Accepted

Solution code:
N = int(input())
rates = list(input().split())

for i in range(len(rates)):
    rates[i] = int(rates[i]) // 400

MAX = 0
MIN = 0
j = 0
while j <= 8:
    for k in range(N):
        if j != 8 and j == rates[k]:
            MAX += 1
            MIN += 1
            break
        elif j == 8 and j <= rates[k]:
            MAX += 1
            if MIN == 0:
                MIN = 1
                continue
            continue
    j += 1

print(MIN, MAX)

Submission status: Accepted

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

li = [0] * 9

for i in a:
    if i >= 3200:
        li[-1] += 1
    else:
        li[i//400] += 1

ans = 0

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

if li[-1] == 0:
    print(ans, ans)
else:
    if ans == 0:
        print(1, li[-1])
    else:
        print(ans, ans+li[-1])

Submission status: Accepted

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

min_c=color
if min_c==0:
	min_c+=1
max_c=color+god
if max_c>8:
	mac_c=8
		
print(min_c,max_c)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
arr= limii()

bs = [0,399,799,1199,1599,1999,2399,2799,3199,4801]
bc = [0,1,2,3,4,5,6,7,8]
ans = [0,0,0,0,0,0,0,0,0]

for i in range(n):
    score = arr[i]
    chk=True
    ank=0
    while chk:
        if bs[ank]<score<=bs[ank+1]:
            chk=False
        ank+=1
    ans[ank-1]+=1

for i in range(8):
    if ans[i]>0:
        ans[i]=1
if sum(ans[:-1])!=0:
    print(str(sum(ans[:-1]))+" "+str(sum(ans)))
else:
    print(str(1)+" "+str(sum(ans)))

Submission status: Accepted

Solution code:
#cant fix re, just copy and paste.
n = int(input())
a = list(map(int, input().split()))
a.sort()
free=0
cset=set()
for rate in a:
    color = int(rate / 400)
    if color >=8:
        free+=1
    else:
        cset.add(color)

colormin=len(cset)
colormax=colormin+free
 
print(str(max(1,colormin)), colormax)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
x = dict()
y = []
if N==1:
    S = "1"+" "+"1"
    print(S)
    exit()
for i in range(N):
    if a[i]<=399:
        x["gray"] = 1
    elif a[i]<=799:
        x["brown"] = 1
    elif a[i]<=1199:
        x["green"] = 1
    elif a[i] <=1599:
        x["lightblue"] = 1
    elif a[i] <= 1999:
        x["blue"] = 1
    elif a[i]<=2399:
        x["yellow"] = 1
    elif a[i]<=2799:
        x["orange"] = 1
    elif a[i]<=3199:
        x["red"] = 1
    else:
        y.append(a[i])

ans = 0
for idx in x:
    ans += 1
n = len(y)
m = ans
M = ans + n
s = ""
if m==0:
    m=1
s = str(m)+" "+str(M)
print(s)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
free=0
cset=set()
for rate in a:
    color = int(rate / 400)
    if color >=8:
        free+=1
    else:
        cset.add(color)

colormin=len(cset)
colormax=colormin+free

print(str(max(1,colormin)), colormax)

Submission status: Accepted

Solution code:
n = int(input())
s = list(map(int, input().split()))
a = [0]*9
c = ""
mn = 400
mx = 399
for i in s:
    if 1 <= i <= mx:
        a[0] = 1
    elif mn <= i <= mx+mn:
        a[1] = 1
    elif mn*2 <= i <= mx+mn*2:
        a[2] = 1
    elif mn*3 <= i <= mx+mn*3:
        a[3] = 1
    elif mn*4 <= i <= mx+mn*4:
        a[4] = 1
    elif mn*5 <= i <= mx+mn*5:
        a[5] = 1
    elif mn*6 <= i <= mx+mn*6:
        a[6] = 1
    elif mn*7 <= i <= mx+mn*7:
        a[7] = 1
    elif  mn*8 <= i <= mn*12:
        a[8] += 1

if a[8] > 0:
    c = "".join(map(str,a))
    c = c.replace("0","")
    if len(c) == 1:
        print(1,sum(a))
    else:
        print(sum(a)-a[8],sum(a))
elif a[8] == 0:
    print(sum(a), sum(a))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = [0 for i in range(8)]
over = 0
for i in range(n):
  if a[i] >= 3200:
    over += 1
  else:
    ans[a[i]//400] = 1

    

print(str(max(1, sum(ans))) + " " + str(sum(ans)+over))

Submission status: Accepted

Solution code:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N=one_int()

A=many_int()

def color_check(num):
    if 1<=num<=399:
        return "hai"
    elif 400<=num<=799:
        return "tya"
    elif 800<=num<=1199:
        return "midori"
    elif 1200<=num<=1599:
        return "mizu"
    elif 1600<=num<=1999:
        return "ao"
    elif 2000<=num<=2399:
        return "ki"
    elif 2400<=num<=2799:
        return "dai"
    elif 2800<=num<=3199:
        return "aka"
    return ""

output = []
overs = 0
for a in A:
    if a >= 3200:
        overs+=1
    else:
        output.append(color_check(a))

cols = len(set(output))
if cols==0:
    cols = 1 
    overs -= 1 
print(cols, cols+overs)

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))
rate = [0]*9
ans = 0

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

for i in range(8):
    if rate[i] != 0:
        ans += 1

if ans == 0:
    print("1", rate[8])
elif rate[8] != 0:
    print(ans, ans+rate[8])
else:
    print(ans, ans)

Submission status: Accepted

Solution code:
n = int(input())
a = [0 for i in range(13)]
for i in map(int, input().split()):
    a[i // 400] += 1
ans = 0
add = 0
for i in range(8):
    if a[i]:
        ans += 1
for i in range(8,13):
    if a[i]:
        add += a[i]
if ans == 0:
    print(1, add)
else:
    print(ans, ans+add)

Submission status: Accepted

Solution code:
int_n = int(input())
arr_int_a = list(map(int, input().split()))

w_s = set()
counter = 0
for i in arr_int_a:
    if i < 3200:
        w_s.add(i // 400)
    else:
        counter += 1

print(len(w_s) if len(w_s) != 0 else 1, len(w_s) + counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
color = [0] * 9
flag = False
for i in range(len(A)):
	flag = False
	for j in range(8):
		if 400 * j <= A[i] and A[i] <= 400 * (j + 1) - 1:
			color[j] = 1
			flag = True
	if flag == False:
		color[-1] += 1
print(max(sum(color[:-1]),1),sum(color))

Submission status: Accepted

Solution code:
N = int(input())
a=list(map(int,input().split()))
b=[0]*8
x=0
for i in range(0,N):
    if a[i]>=3200:
        x=x+1
        continue
    else:
        b[a[i]//400]=1
y=x
for i in range(0,8):
    x=x+b[i]
if x-y==0:
    print(1,x)
else:
    print(x-y,x)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
rate = [0] * 8
rate_big = 0
for i in range(N):
    if A[i] < 3200:
        rate[A[i] // 400] += 1
    else:
        rate_big += 1
ans_min = 0
ans_max = 0
for j in range(8):
    if rate[j] > 0:
        ans_min += 1
if ans_min == 0:
    ans_min = 1
    ans_max = rate_big
else:
    ans_max = ans_min+rate_big
print(ans_min, ans_max, sep=" ")

Submission status: Accepted

Solution code:
n=int(input())
ci=[0]*8
ov=0
a=list(map(int,input().split()))
for pt in a:
  if pt>=3200:
    ov+=1
  else:
    ci[pt//400]=1
ans = sum(ci)
print(max(1,ans),ans+ov)

Submission status: Accepted

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

colors = [0 for _ in range(8)]
over = 0

for a in A:
    if 3200 <= a:
        over += 1
    else: 
        colors[a // 400] = 1

c = colors.count(1)

maxi = c + over

if c == 0:
    mini = 1
else:
    mini = c

print(mini, maxi)

Submission status: Accepted

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

colors = [0 for _ in range(8)]
over = 0

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

c = colors.count(1)

maxi = c + over

if c == 0:
    mini = 1
else:
    mini = c

print(mini, maxi)

Submission status: Accepted

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

colors = [0 for _ in range(8)]
over = 0

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

c = colors.count(1)

if over == 0:
    maxi = c
else:
    maxi = c + over

if c == 0:
    mini = 1
else:
    mini = c

print(mini, maxi)

Submission status: Accepted

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

## define
class ColorRank():
    def __init__(self, color, low, high):
        self.color = color
        self.low = low
        self.high = high
        self.cnt = 0

rate_list = [ ColorRank( "hai", 1, 399 )
             ,ColorRank( "cha", 400, 799 )
             ,ColorRank( "midori", 800, 1199 )
             ,ColorRank( "mizu", 1200, 1599 )
             ,ColorRank( "ao", 1600, 1999 )
             ,ColorRank( "ki", 2000, 2399 )
             ,ColorRank( "daidai", 2400, 2799 )
             ,ColorRank( "aka", 2800, 3199 )
             ,ColorRank( "top", 3200, 4800 )
             ]

## main
for an in An_list:
    for i,rate in enumerate( rate_list ):
        if rate.low <= an <= rate.high:
            rate_list[i].cnt += 1
            break

rateN = len([ color_rank for color_rank in rate_list if color_rank.cnt > 0 and color_rank.color != "top" ])
N_min = 1 if rateN == 0 and rate_list[8].cnt > 0 else 0
N_max = rate_list[8].cnt if rate_list[8].cnt > 0 else 0
rateN_min = rateN + N_min
rateN_max = rateN + N_max
print( ' '.join( [ str(rateN_min), str(rateN_max) ] ) )

Submission status: Accepted

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

maximum = 0
minimum = 0
used = [0]*9
for i in A:
    i //= 400
    if i >= 8:
        maximum += 1
    elif used[i] == 0:
        maximum += 1
        minimum += 1
        used[i] = 1
if minimum == 0:
    minimum += 1
print(minimum, maximum)

Submission status: Accepted

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

color = [0] * 8
cnt = 0
for val in a:
    for i in range(8):
        if 400 * i <= val < 400 * (i + 1):
            color[i] = 1
    if val >= 3200:
            cnt += 1

if all([c == 0 for c in color]):
    s = 1
else:
    s = sum(color)
l = sum(color) + cnt

print(s, l)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    scores = [i*400 for i in range(1, 8)]
    scores.reverse()

    scores_d = {}
    input()
    god = []
    for a in map(int,input().split()):
        if a >= 3200:
            god.append(a)
            continue
        for i in scores:
            if a >= i:
                scores_d[i] = 1
                break
        if a < 400:
            scores_d[0] = 1

    counts = sum(scores_d.values())
    print(counts if counts > 0 else 1, counts + len(god))

main()

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
C=[]
cnt=0
for i in A:
  if 1<=i<=399:
    C.append('a')
  elif 400<=i<=799:
    C.append('b')
  elif 800<=i<=1199:
    C.append('c')
  elif 1200<=i<=1599:
    C.append('d')
  elif 1600<=i<=1999:
    C.append('e')
  elif 2000<=i<=2399:
    C.append('f')
  elif 2400<=i<=2799:
    C.append('g')
  elif 2800<=i<=3199:
    C.append('h')
  else:
    cnt+=1
D=len(set(C))
if D==0:
  print(1,cnt)
else:
  print(D,D+cnt)

Submission status: Accepted

Solution code:
# 2020/01/30
# AtCoder Beginner Contest 064 - C

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

# Count
ans = 0

a.sort()
wk_r = -1
a_max = 0
cnt = 0
for i in range(n):
    if a[i] >= 3200:
        a_max = cnt + (n - i)
        break
    
    rank = a[i] // 400
    if wk_r != rank:
        cnt = cnt + 1
        wk_r = rank

a_min = max(1, cnt)
if a[n-1] < 3200:
    a_max = cnt

# Output
print(a_min, a_max)

Submission status: Accepted

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

l = [0 for i in range(9)]
for a in A:
  ind = 0
  while ind < 8:
    if a < (ind+1)*400:
      break
    ind += 1
  l[ind] += 1

ans_max = 0
ans_min = 0
for i in range(0, 8):
  if l[i] > 0:
    ans_max += 1
    ans_min += 1
if l[-1] > 0:
  ans_max = ans_max + l[-1]
  ans_min = max(ans_min, 1)
print(ans_min, ans_max)

Submission status: Accepted

Solution code:
N = int(input())
lst = [0] * 9

for x in [int(x) for x in input().split()]:
    if x <= 399:
        lst[0] = 1
    elif x <= 799:
        lst[1] = 1
    elif x <= 1199:
        lst[2] = 1
    elif x <= 1599:
        lst[3] = 1
    elif x <= 1999:
        lst[4] = 1
    elif x <= 2399:
        lst[5] = 1
    elif x <= 2799:
        lst[6] = 1
    elif x <= 3199:
        lst[7] = 1
    else:
        lst[8] += 1

a = sum(lst[:-1])
b = lst[8]
if a == 0 and b > 0:
    print("1 {0}".format(b))
else:
    print("{0} {1}".format(a, a + b))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
a = list(map(int,input().split()))
color = [0]*8
over_3200 = 0
for i in range(n):
    if a[i] < 3200:
        color[a[i] // 400] = 1
    else: over_3200 += 1
if sum(color) == 0:
    print(1,over_3200)
else:
    print(sum(color),sum(color)+over_3200)

Submission status: Accepted

Solution code:
n = int(input())

count = 0
colors = [0]*8
cList = list(map(int,input().split()))

for i in cList:
  if i >= 3200:
    count += 1
  else:
    colors[(i//400)] = 1

if sum(colors) != 0: 
  print(sum(colors),sum(colors)+count)
else:
  print(1,sum(colors)+count)

Submission status: Accepted

Solution code:

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

colors = { "gray": 0, "brown": 0, "green": 0, "water": 0, "blue": 0, "yellow": 0, "orange": 0, "red": 0 }

other = 0

for a in A:
  if 1 <= a <= 399:
    colors["gray"] += 1
  elif 400 <= a <= 799:
    colors["brown"] += 1
  elif 800 <= a <= 1199:
    colors["green"] += 1
  elif 1200 <= a <= 1599:
    colors["water"] += 1
  elif 1600 <= a <= 1999:
    colors["blue"] += 1
  elif 2000 <= a <= 2399:
    colors["yellow"] += 1
  elif 2400 <= a <= 2799:
    colors["orange"] += 1
  elif 2800 <= a <= 3199:
    colors["red"] += 1
  else:
    other += 1

num = len(list(filter(lambda x: x > 0, colors.values())))

if num == 0:
  print(1, other)
else:
  print(num, num + other)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
color = [0 for i in range(9)]
a.sort()
for i in a:
    number = i//400
    if number >=8:
        color[8] += 1
    else:
        color[number] += 1
left = 8 - color[:8].count(0) #3200未満が何種類あるか
right = color[8]              #3200以上が何人いるか
if left == 0:
    print('{} {}'.format(1,right))
else:
    sum_color = left + right
    print('{} {}'.format(left,sum_color))

Submission status: Accepted

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

s = 0
for i in range(8):
    if rank[i] > 0:
        s += 1
if s > 0:
    s1 = s
else:
    s1 = 1
s2 = s + rank[8]
print(s1, s2)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=[0,0,0,0,0,0,0,0]
red=int(0)
for i in range(n):
    now=int(A[i]/400)
    if now<8:
        B[now]=1
    else:
        red+=1

ans=B.count(1)
if ans==0:
    ans=1
    red-=1
print("{} {}".format(ans,ans+red))

Submission status: Accepted

Solution code:
if __name__ == '__main__':

	#入力
	N = int(input())
	score_lst = [int(a) for a in input().split()]
	grade_lst = []
	for i in score_lst:
		grade = int(i / 400)
		if grade > 7:
			grade = 8
		grade_lst.append(grade)

	count = 0

	for i in range(0,8):
		if grade_lst.count(i) > 0:
			count += 1

	if count != 0:
		min_count = count
	else:
		min_count = 1
	max_count = count + grade_lst.count(8)

	print("{} {}".format(min_count,max_count))

Submission status: Accepted

Solution code:
import sys
import numpy as np

# N 参加した人数
n = int(input())

# ai 各参加者のレート
rate = list(map(int, input().split()))

# 各レートによる人数
people = np.zeros(8)
# 3200以上の好きな色を選べる人数
free = 0

for r in rate:
    # レートによって人数を求める
    if r < 400:
        people[0] += 1
    elif r < 800:
        people[1] += 1
    elif r < 1200:
        people[2] += 1
    elif r < 1600:
        people[3] += 1
    elif r < 2000:
        people[4] += 1
    elif r < 2400:
        people[5] += 1
    elif r < 2800:
        people[6] += 1
    elif r < 3200:
        people[7] += 1
    else:
        free += 1

if people[people > 0].size > 0:
    # 最小は色の数
    min_color = people[people > 0].size
    # 最大は、最小 + 選べる人数
    max_col = min_color + free
else:
    # 高得点者しかいない場合、最小は 1
    min_color = 1
    # 最大は高得点者
    max_col = free

print(min_color, max_col)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
c=0
s=set()
for i in a:
  if i<400:
    s.add(0)
  elif i<800:
    s.add(1)
  elif i<1200:
    s.add(2)
  elif i<1600:
    s.add(3)
  elif i<2000:
    s.add(4)
  elif i<2400:
    s.add(5)
  elif i<2800:
    s.add(6)
  elif i<3200:
    s.add(7)
  elif i>=3200:
    c+=1
print(max(len(s),1),len(s)+c)

Submission status: Accepted

Solution code:
N = int(input())
a = [min(int(i) // 400, 8) for i in input().split()]

n, c = 0, 0
ranks = set()
for a_i in a:
    if a_i == 8:
        n += 1
    else:
        ranks.add(a_i)

min_v = len(ranks)
max_v = len(ranks)
if n > 0:
    min_v = max(1, len(ranks))
    max_v = max_v + n

print(min_v, max_v)

Submission status: Accepted

Solution code:
from collections import Counter
input()
A = list(map(int, input().split()))
C = Counter([sum(a >= r for r in [400,800,1200,1600,2000,2400,2800,3200]) for a in A])
c8 = C[8] if 8 in C else 0
a1 = len(C) - (1 if c8 else 0)
a2 = a1+c8
if a1 == 0:
    a1 += 1
print(a1, a2)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    color = [0] * 9
    ans = 0
    for a in A:
        if a >= 3200:
            color[8] += 1
        else:
            color[a // 400] += 1

    mi = 0
    for c in color[:8]:
        if c > 0:
            mi += 1
    if mi == 0:
        print(1, color[8])
    else:
        print(mi, mi + color[8])



    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
cnt = []
cnt_r = 0
for i in range(n):
    for j in range(1, 9):
        if a[i] < 400*j:
            if j not in cnt:
                cnt.append(j)
            break
    else:
        cnt_r += 1
if len(cnt) == 0:
    print(1, cnt_r)
else:
    print(len(cnt), len(cnt)+cnt_r)

Submission status: Accepted

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

c = [0] * 9

for rate in a:
    i = rate // 400
    if i < 8:
        c[i] = 1
    else:
        c[8] += 1

c_sum = sum(c[:8])
c_min = max(c_sum, min(c[8],1))
c_max = c_sum + c[8]

print(c_min, c_max)

Submission status: Accepted

Solution code:
import sys
n = int(input())
l = [int(i)//400 if int(i)//400 <= 7 else 8 for i in input().split()]
multi = l.count(8)
if multi == 0:
    num_cols = len(set(l))
    print(num_cols, num_cols)
    sys.exit()
    
num_cols = len(set(l)) - 1
min_cols = max(1,num_cols)
max_cols = num_cols+multi
print(min_cols, max_cols)

Submission status: Accepted

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

c = [0] * 9

for rate in a:
    i = rate // 400
    if i < 8:
        c[i] = 1
    else:
        c[8] += 1

c_sum = sum(c[:8])
c_min = max(c_sum, 1)
c_max = c_sum + c[8]

print(c_min, c_max)

Submission status: Accepted

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

c = [0] * 9

for rate in a:
    i = rate // 400
    if i < 8:
        c[i] = 1
    else:
        c[8] += 1

c_sum = sum(c[:8])
c_min = max(c_sum, 1)
c_max = c_sum + c[8]

print(c_min, c_max)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    A = list(map(int,input().split()))
    m = {}
    for x in A:
        i = min(3200 // 400,x // 400)
        m[i] = m.get(i,0) + 1
    mi = 0
    ma = 0
    for x in range(3200 // 400):
        if m.get(x,0) > 0:
            mi = mi + 1
    if mi == 0:
        mi = 1
        ma = -1
    ma += mi
    ma += m.get(3200 // 400,0)

    print("{} {}".format(mi,ma))
if __name__ == '__main__':
    main()

Submission status: Accepted

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

c = sum([1 for i in r[:-1] if i != 0])
t = r[-1]

if c == 0:
    print(1, t)
else:
    print(c, c+t)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())
N = int(input())
a = list(map(int, input().split()))

C = [0 for _ in range(9)]

for i in range(N) :
  if a[i] < 3200 :
    C[a[i]//400] += 1
  else :
    C[8] += 1

minN = 0
maxN = 0
for j in range(8) :
  if C[j] > 0 :
    minN += 1
  
#maxN = min(minN + C[8], 8)
maxN = minN + C[8]

if minN == 0 :
  minN = 1
  
print (str(minN) + " " + str(maxN))

Submission status: Accepted

Solution code:
import sys
import bisect
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
ls = [i * 400 - 1 for i in range(1, 9)]
_set = set()
n_max = 0
for a in a_ls:
    ind = bisect.bisect_left(ls ,a)
    if ind == 8:
        n_max += 1
    else:
        _set.add(ind)
_min = max(len(_set), 1)
print(_min, len(_set) + n_max)