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:
def color(num: int) -> int:
    if 1 <= num <= 399:
        return 0
    if 400 <= num <= 799:
        return 1
    if 800 <= num <= 1199:
        return 2
    if 1200 <= num <= 1599:
        return 3
    if 1600 <= num <= 1999:
        return 4
    if 2000 <= num <= 2399:
        return 5
    if 2400 <= num <= 2799:
        return 6
    if 2800 <= num <= 3199:
        return 7
    if 3200 <= num:
        return 8


n = int(input())
a = list(map(int, input().split()))
arr = []
certain = 0
for num in a:
    col = color(num)
    if col == 8:
        certain += 1
    else:
        arr.append(col)

color_count = len(set(arr))
if color_count == 0:
    print(1, certain)
else:
    print(color_count, color_count + certain)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    d = defaultdict(int)
    free = 0
    for i in range(N):
        if 1<=A[i]<400:
            d['gray'] += 1
        elif 400<=A[i]<800:
            d['brown'] += 1
        elif 800<=A[i]<1200:
            d['green'] += 1
        elif 1200<=A[i]<1600:
            d['light_blue'] += 1
        elif 1600<=A[i]<2000:
            d['blue'] += 1
        elif 2000<=A[i]<2400:
            d['yellow'] += 1
        elif 2400<=A[i]<2800:
            d['orange'] += 1
        elif 2800<=A[i] < 3200:
            d['red'] += 1
        else:
            free += 1
    ans_min = max(len(d.keys()), 1)
    ans_max = len(d.keys())+free
    print(ans_min, ans_max)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
L = [False]*8
cnt = 0
for i in range(N):
    for j in range(8):
        if j*400 <= a[i] <= j*400+399:
            L[j] = True
    if a[i] >= 3200:
        cnt += 1
if L.count(1):
    minnum = L.count(1)
else:
    minnum = 1
maxnum = min(N, minnum+cnt)
print(minnum, maxnum)

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int,input().split()))
color = [0]*9
def col(x):
  if 1<=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
  elif x>=3200:
    return 8
  
for i in l:
  a = col(i)
  color[a] += 1
color2 = [1 for i in color if i!=0]
if color[8]==0:
  print(len(color2),len(color2))
else:
  print(max(len(color2)-1,1),len(color2)-1+color[8])

Submission status: Accepted

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

Submission status: Accepted

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

for r in a:
    if r > 3199:
        free += 1
    else:
        ans[r // 400] = 1

min_ = max(sum(ans), 1)
#max_ = min(sum(ans) + free, 8)
max_ = sum(ans) + free
print(min_, max_)

Submission status: Accepted

Solution code:
A = int(input())
colors = [0] * 8
l_n = list(map(int,input().split()))
if [i for i in l_n if 1 <= i <= 399] != []:
        colors[0] = 1
for j in range(1,8):
    if [i for i in l_n if 0+(j*400) <= i <= 399+(j*400)] != []:
        colors[j] = 1
ans_m = colors.count(1)
all_colors = len([i for i in l_n if 3200 <= i])
if all_colors == A:
    print(1,all_colors)
else:
    print(ans_m,ans_m+all_colors)

Submission status: Accepted

Solution code:
colors=[0]*8
n=int(input())
a=list(map(int,input().split()))
wild=0
for i in range(n):
  index=a[i]//400
  if a[i]>=3200:
    wild+=1
  else:
    colors[index]=1
ans1=sum(colors)
ans2=sum(colors)
ans1+=wild
if ans2==0 and wild>0:
  ans2=1
print(ans2,' ',ans1)

Submission status: Accepted

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

huriwake = [0, 0, 0, 0, 0, 0, 0, 0]
rea = 0
count = 0

for i in list:
    if i < 400:
        huriwake[0] = 1
    elif i < 800:
        huriwake[1] = 1
    elif i < 1200:
        huriwake[2] = 1
    elif i < 1600:
        huriwake[3] = 1
    elif i < 2000:
        huriwake[4] = 1
    elif i < 2400:
        huriwake[5] = 1
    elif i < 2800:
        huriwake[6] = 1
    elif i < 3200:
        huriwake[7] = 1
    else:
        rea += 1

for h in huriwake:
    if h == 1:
        count += 1

if count == 0 and rea > 0:
    count += 1
    rea -= 1

min = count

if rea > 0:
    count += rea

max = count

print("{0} {1}".format(min, max))

Submission status: Accepted

Solution code:
def resolve():
	n = input()
	c = [False] * 8
	p = 0
	for i in list(map(int, input().split())):
		if i >= 3200:
			p += 1
		else:
			c[i//400] = True
	print(sum(c) or 1, sum(c) + p)
resolve()

Submission status: Accepted

Solution code:
N = int(input())
an = list(map(int, input().split()))
free = 0
check = []
for a in an:
    if a > 3199:
        free += 1
    else:
        check.append(a//400)
print(max(1, len(set(check))), len(set(check))+free)

Submission status: Accepted

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

for i in range(n):
    A[i] //= 400
    if A[i] > 7:
        A[i] = "*"
        
over3200 = A.count("*")

base = len(set(A))

if over3200 > 0:
    base -= 1

if over3200 == n:
    print(1,base+over3200)
else:
    print(base,base+over3200)

Submission status: Accepted

Solution code:
N=int(input())
A=[int(x) for x in input().split()]
count=0
for i in range(N):
    if 1<=A[i]<=399:
        A[i]=1
    elif 400<=A[i]<=799:
        A[i]=2
    elif 800<=A[i]<=1199:
        A[i]=3
    elif 1200<=A[i]<=1599:
        A[i]=4
    elif 1600<=A[i]<1999:
        A[i]=5
    elif 2000<=A[i]<=2399:
        A[i]=6
    elif 2400<=A[i]<=2799:
        A[i]=7
    elif 2800<=A[i]<=3199:
        A[i]=8
    else:
        A[i]=9
        count+=1

A=[x for x in set(A)]

if A==[9]:
    print(1,count)
else:
    if 9 in A:
        print(len(A)-1,len(A)-1+count)
    else:
        print(len(A),len(A))

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x: x//400, A))
#print(A)

import collections
c = collections.Counter(A)
#print(c)
f1 = f2 = 0
for k in c.keys():
    if k >= 8:
        f1 += 1
        f2 += c[k]
        
if f1 == 0:
    min_ = max_ = len(c.keys())

else:
    min_ = len(c.keys()) -f1
    max_ = len(c.keys()) -f1 +f2
'''if max_ >8:
    max_ = 8'''
if min_ <1:
    min_ = 1
print(min_, max_)

Submission status: Accepted

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

def intinp():
    return int(input())

N = intinp()
a = mapint_inp()

def get_color(x):
    c = None
    if 399 >= x: c = "Gray"
    elif 799 >= x: c = "Blown"
    elif 1199 >= x: c = "Green"
    elif 1599 >= x: c = "Sky"
    elif 1999 >= x: c = "Blue"
    elif 2399 >= x: c = "Yellow"
    elif 2799 >= x: c = "Orange"
    elif 3199 >= x: c = "Red"
    else:
        c = "Any"
    return c

color_set = set()
num_of_any = 0

for a_i in a:
    c_i = get_color(a_i)
    if c_i == "Any":
        num_of_any += 1
        continue
    if c_i not in color_set:
        color_set.add(c_i)

num_of_colors = len(color_set)

if num_of_colors == 0:
    print(1, num_of_any)
else:
    print(num_of_colors, num_of_colors+num_of_any)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N):
  if List[i] < 400:
    color[0] += 1
  elif 400<= List[i] < 800:
    color[1] += 1
  elif 800<= List[i] < 1200:
    color[2] += 1
  elif 1200<= List[i] < 1600:
    color[3] += 1
  elif 1600<= List[i] < 2000:
    color[4] += 1
  elif 2000<= List[i] < 2400:
    color[5] += 1
  elif 2400<= List[i] < 2800:
    color[6] += 1
  elif 2800<= List[i] < 3200:
    color[7] += 1
  else:
    color[8] += 1
#print(color)
cmin = 0
for i in range(8):
    if color[i]>0:
        cmin += 1
        
cmax = cmin+color[8]
if cmin ==0:
    cmin = 1
print(cmin,cmax)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc064/tasks/abc064_c
# C - Colorful Leaderboard
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    etc, red = [], []
    for a in A:
        etc.append(a // 400) if (a // 400) < 8 else red.append(a // 400)

    ma = len(set(etc)) + len(red)
    mi = len(set(etc)) + 0 if len(set(etc)) != 0 else 1
    print(mi, ma)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    res1 = []
    res2 = []
    for i in range(n):
        a = A[i] // 400
        if a < 8:
            res1.append(a)
        else:
            res2.append(a)

    ma = len(set(res1)) + len(res2)
    mi = len(set(res1)) + 0 if len(set(res1)) != 0 else 1
    print(mi, ma)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int,input().split()))
A.sort()
dict = [0 for _ in range(8)]
B = []
for a in A:
    if 3200 <= a:
        B.append(a)
        continue
    for i in range(8):
        if i*400 <= a and a < (i+1)*400:
            dict[i]+=1
            break
ds = 8-dict.count(0)
maxNum = ds
minNum = ds
if len(B) > 0:
    maxNum += len(B)
    minNum = max(minNum,1)
print(minNum,maxNum)

Submission status: Accepted

Solution code:

n = int(input())
A = list(map(int, input().split()))
dp = [0] * 9
for i in A:
    s = i // 400
    if s >= 8:
        dp[-1] += 1
    else:
        dp[s] = 1
 
ans = 0
for j in range(len(dp) - 1):
    ans += dp[j]
    
if ans == 0:
    print(1, dp[-1])
else:    
    print(ans, sum(dp))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
x1, x2, x3, x4, x5, x6, x7, x8, x9 = 0, 0, 0, 0, 0, 0, 0, 0, 0

for i in a:
    if i < 400:
        x1 = 1
    elif i < 800:
        x2 = 1
    elif i < 1200:
        x3 = 1
    elif i < 1600:
        x4 = 1
    elif i < 2000:
        x5 = 1
    elif i < 2400:
        x6 = 1
    elif i < 2800:
        x7 = 1
    elif i < 3200:
        x8 = 1
    else:
        x9 += 1
mini = max(x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8, 1)
maxi = x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9
print(mini, maxi)

Submission status: Accepted

Solution code:
def resolve():
    import collections
    N = int(input())
    A = list(map(int, input().split()))
    d = collections.OrderedDict([
        (400, 0),
        (800, 0),
        (1200, 0),
        (1600, 0),
        (2000, 0),
        (2400, 0),
        (2800, 0),
        (3200, 0)
    ])
    other = 0
    for a in A:
        for th in d:
            if a < th:
                d[th] += 1
                break
        else:
            other += 1
    mincolor = 0 if other != N else 1
    for th in d:
        if d[th] > 0:
            mincolor += 1
    maxcolor = mincolor+other if other != N else other
    print("{} {}".format(mincolor, maxcolor))
    

if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
n=int(input())
s=list(map(int,input().split()))
t=[]
var=0
over=0
for i in s:
    if i//400 >= 8:
        over+=1
    elif i//400 in t:
        pass
    else:
        var+=1
        t.append(i//400)

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

Submission status: Accepted

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

rainbow=0
rate=[]

for i in A:
    if (i>=3200):
        rainbow+=1
    else:
        rate.append(i//400)
#print(rate)
cnt=len(set(rate))
print(max(1,cnt),cnt+rainbow)

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    A = list(map(int, input().split()))
    color = defaultdict(int)
    g = 0
    for a in A:
        if a >= 3200:
            g += 1
            continue
        for j in range(8):
            if 400 * j <= a < 400 * (j + 1):
                color[j] = 1
    print(max(1, len(color)), len(color) + g)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    from collections import Counter

    N = int(input())
    a = map(int, input().split())

    a = map(lambda x: min(8, x // 400), a)

    ctr = Counter(a)

    len_ = len(ctr.keys())
    free = ctr[8]
    if free:
        ma = len_ - 1 + free
        mi = max(1, len_ - 1)
        ans = mi, ma
    else:
        ans = len_, len_
    print(*ans)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
B=[]
C=[]
for i in A:
    if i<=399:
        B.append(1)
    elif i<=799:
        B.append(2)
    elif i<=1199:
        B.append(3)
    elif i<=1599:
        B.append(4)
    elif i<=1999:
        B.append(5)
    elif i<=2399:
        B.append(6)
    elif i<=2799:
        B.append(7)
    elif i<=3199:
        B.append(8)
    else:
        C.append(1)

D=set(B)
minans=len(D)
if C:
    maxans=len(C)+minans
else:
    maxans=minans
    
print(max(minans,1), maxans)

Submission status: Accepted

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

  
def judge(n):
  return n//400

rate=[0]*8
masters=0
for a in A:
  if judge(a)<8:
    rate[judge(a)]+=1
  else:
    masters+=1
  
count=0
for r in rate:
  if r!=0:
    count+=1
MAX=count+masters


print(max(1,count),MAX)

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())

gray=0
brown=0
green=0
water=0
blue=0
yellow=0
orange=0
red=0
overred=0

for i in a:
  if 1<=i<400:
    gray=1
  elif 400<=i<800:
    brown=1
  elif 800<=i<1200:
    green=1
  elif 1200<=i<1600:
    water=1
  elif 1600<=i<2000:
    blue=1
  elif 2000<=i<2400:
    yellow=1
  elif 2400<=i<2800:
    orange=1
  elif 2800<=i<3200:
    red=1
  else:
    overred+=1
    
ans=gray+brown+green+water+blue+yellow+orange+red

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

Submission status: Accepted

Solution code:
li=[0]*8
o=0
n,*a=map(int,open(0).read().split())
for i in a:
  if i>=3200:o+=1  
  else:li[i//400]=1
if sum(li)==0:print(1,min(o,8))
else:print(sum(li),(sum(li)+o))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
l = []
aaa = 0
for i in a:
    if i<400:
        l.append("hai")
    elif i<800:
        l.append("tya")
    elif i<1200:
        l.append("midori")
    elif i<1600:
        l.append("mizu")
    elif i<2000:
        l.append("ao")
    elif i<2400:
        l.append("ki")
    elif i<2800:
        l.append("dai")
    elif i<3200:
        l.append("aka")
    else:
        aaa+=1
x = len(set(l))
print(max(1,x),x+aaa)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))

l = [0] * 9
mn = 0
for i in A:
    t = min(i // 400, 8)
    l[t] += 1
for i in range(8):
    if l[i] != 0:
        mn += 1
if mn == 0:
    mn = 1
    mx = l[8]
else:
    mx = mn + l[8]

print(mn, mx)

Submission status: Accepted

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

l = [0] * 9
mn = 0
for i in A:
    t = min(i // 400, 8)
    l[t] += 1
for i in range(8):
    if l[i] != 0:
        mn += 1
if mn == 0:
    mn = 1
    mx = l[8]
else:
    mx = mn + l[8]

print(mn, mx)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    A = list(map(int, input().split()))
    color = defaultdict(int)
    god = 0
    for i in A:
        if i < 400:
            color['gray'] = 1
        elif i < 800:
            color['brown'] = 1
        elif i < 1200:
            color['green'] = 1
        elif i < 1600:
            color['light_blue'] = 1
        elif i < 2000:
            color['blue'] = 1
        elif i < 2400:
            color['yellow'] = 1
        elif i < 2800:
            color['orange'] = 1
        elif i < 3200:
            color['red'] = 1
        else:
            god += 1
    print(max(1, len(color)), len(color) + god)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))

d = defaultdict(int)
strong = 0

for a in A:
    if a >= 3200:
        strong += 1
        continue
    d[a // 400] += 1

Cmin = max(len(d), 1)
Cmax = len(d) + strong
print(Cmin, Cmax)

Submission status: Accepted

Solution code:
N=int(input())
m=list(map(int,input().split()))
ans=0
rainbow=0
table=[0,0,0,0,0,0,0,0]
for i in m:
  if i>3199:
    rainbow+=1
  else:
    if table[i//400]==0:
      ans=ans+1
      table[i//400]=1
print(max(1,sum(table)),sum(table)+rainbow)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
# if n==1:
#   print(1)
#   exit(0)
for i in range(n):
  if 1<=a[i]<=399:
    a[i]="gray"
  elif 400<=a[i]<=799:
    a[i]="brown"
  elif 800<=a[i]<=1199:
    a[i]="green"
  elif 1200<=a[i]<=1599:
    a[i]="lightblue"
  elif 1600<=a[i]<=1999:
    a[i]="blue"
  elif 2000<=a[i]<=2399:
    a[i]="yellow"
  elif 2400<=a[i]<=2799:
    a[i]="orange"
  elif 2800<=a[i]<=3199:
    a[i]="red"
  elif 3200<=a[i]:
    a[i]="free"
# print(a)
from collections import Counter
c=Counter(a)
ans=len(c)
free=c["free"]

v_min=ans
v_max=ans
if free>0:
  v_min-=1
if free>0:
  v_max+=free-1
if free==n:
  v_min=1
print(v_min,v_max)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc064/tasks/abc064_c
N = read_a_int()
A = read_ints()

if N == 1:  # コーナーケースかー
    print(1, 1)
    exit()


# 色は400ごとに変化(400で割っておくと処理が楽そう)
import numpy as np
A = np.array(A) // 400

cnt = Counter(A)
# print(cnt)
ans_min = 0
ans_max = 0
for k, v in cnt.items():
    if k >= 8:
        ans_max += v
    else:
        ans_min += 1
        ans_max += 1
if ans_min == 0:
    ans_min = 1  # 全員レッドコーダー
print(ans_min, ans_max)

Submission status: Accepted

Solution code:
import math

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

Nagasa = len(L)
over = 0

counter = [0]*8

for i in range (0, Nagasa):
	if L[i] >= 3200:
		over+=1
	else:
		counter[math.floor(L[i]/400)]=1

count = sum(counter)

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
color = []
free = 0
for x in a:
    if x < 400:color.append("g")
    elif x < 800:color.append("b")
    elif x < 1200:color.append("gr")
    elif x < 1600:color.append("bl1")
    elif x < 2000:color.append("bl2")
    elif x < 2400:color.append("y")
    elif x < 2800:color.append("o")
    elif x < 3200:color.append("r")
    else: free += 1
color = list(set(color))
ans = len(color)
if ans == 0 and free > 0: ans = 1
print(ans, len(color) + free)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def get_rank(s):
  if s < 400:
    return 0
  elif s < 800:
    return 1
  elif s < 1200:
    return 2
  elif s < 1600:
    return 3
  elif s < 2000:
    return 4
  elif s < 2400:
    return 5
  elif s < 2800:
    return 6
  elif s < 3200:
    return 7
  else:
    return 8

def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  s = set()
  free = 0
  for score in a:
    rank = get_rank(score)
    if (rank == 8):
      free += 1
    else:
      s.add(rank)
  print(max(1, len(s)), len(s) + free)
  return

if __name__ == "__main__":
  resolve()

Submission status: Accepted

Solution code:
from collections import defaultdict
n = int(input())
al = list(map(int, input().split()))


t = 0
d = defaultdict(lambda: 0)
for a in al:
    if a >= 3200:
        t += 1
    else:
        d[str(a // 400)] += 1
if len(d) == 0:
    print(1, t)
else:
    print(len(d), len(d)+t)

Submission status: Accepted

Solution code:
n = int(input())
kinds = set()
rainbow = 0
for a in list(map(int, input().split())):
    color = a // 400
    if color < 8:
        kinds.add(color)
    else:
        rainbow += 1

print(max(len(kinds), 1), len(kinds) + rainbow)

Submission status: Accepted

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

l=[0 for i in range(9)]
for i in a:
  if i>=3200:
    l[-1]+=1
  else:
    l[i//400]+=1

cnt=0
for i in l[:-1]:
  if i!=0:
    cnt+=1

if cnt==0:
  print(1,l[-1])
else:
  print(cnt,cnt+l[-1])

Submission status: Accepted

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    A = readInts()
    dic = defaultdict(int)
    ok = 0
    for i in range(n):
        if 1 <= A[i] <= 399:
            dic['g'] = 1
        elif 400 <= A[i] <= 799:
            dic['b'] = 1
        elif 800 <= A[i] <= 1199:
            dic['gr'] = 1
        elif 1200 <= A[i] <= 1599:
            dic['w'] = 1
        elif 1600 <= A[i] <= 1999:
            dic['bl'] = 1
        elif 2000 <= A[i] <= 2399:
            dic['f'] = 1
        elif 2400 <= A[i] <= 2799:
            dic['bbb'] = 1
        elif 2800 <= A[i] <= 3199:
            dic['adava'] = 1
        else:
            ok += 1
    cnt = 0
    for k,v in dic.items():
        cnt += 1
    if cnt != 0:
        print(cnt,cnt+ok)
    else:
        print(1,ok)
if __name__ == '__main__':
  main()

Submission status: Accepted

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

ansl = [0] * 9

for a in al:
    k = min(a // 400, 8)
    ansl[k] += 1

min_ans = 0
for a in ansl[:8]:
    if a > 0:
        min_ans += 1

max_ans = min_ans
if ansl[-1] > 0:
    if min_ans == 0:
        min_ans += 1
        max_ans += ansl[-1]
    else:
        max_ans = min_ans + ansl[-1]

print(min_ans, max_ans)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
lst = [0] * 10
for a in A:
    tmp = a // 400
    if tmp >= 8:
        count += 1
    else:
        lst[tmp] = 1

ans = sum(lst)
print (max(1, ans), ans + count)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    colors = [0] * 9
    for aa in a:
        index = -1
        for i in range(8):
            if 400 * i <= aa < 400 * (i + 1):
                index = i
        colors[index] += 1
    answer = 0
    for i in range(8):
        if colors[i] > 0:
            answer += 1
    print(max(answer, 1), answer + colors[-1])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = 0
for left in range(0, 2801, 400):
    ans += 1 if [a for a in A if left <= a <= left + 399] else 0

ans1 = ans + len([a for a in A if a >= 3200])
if ans == 0:
    print(1, ans1)
else:
    print(ans, ans1)

Submission status: Accepted

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

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

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

ans_min = max(1,sum(C[:8]))
ans_max = sum(C)
print(ans_min,ans_max)

Submission status: Accepted

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

s=[0]*8
c=0
for ai in a:
    if ai<3200:
        s[ai//400]=1
    else:
        c+=1

ssum=sum(s)
smin=max(1,ssum)
smax=ssum+c
print(smin,smax)

Submission status: Accepted

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

s=[0]*8
c=0
for ai in a:
    if ai<3200:
        s[ai//400]=1
    else:
        c+=1

ssum=sum(s)
if ssum==0:
    smin=1
else:
    smin=ssum
smax=ssum+c
print(str(smin)+" "+str(smax))

Submission status: Accepted

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

b=[]
c=0
for i in a:
    if i<8:
        b.append(i)
    else:
        c+=1
b=set(b)

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

Submission status: Accepted

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

rate_map = [0] * 9
for i in a:
    rate_map[8 if i // 400 > 8  else i // 400] += 1
base = len(list(filter(lambda x: bool(x), rate_map[:8])))
# print(rate_map)
print("{} {}".format(min(rate_map[8], 1) if not bool(base) else base, base+rate_map[8]))