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

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

#全員3200以上==(sum(li)==0)> 1,min(o,8)
#全員3200未満==(o==0)> sum(li),min(sum(li)+o,8)
#それ以外>sum(li)
if sum(li)==0:
  print(1,min(o,8))
else:
  print(sum(li),(sum(li)+o))

Submission status: Accepted

Solution code:
import sys
import numpy as np

n = int(sys.stdin.readline().rstrip())
a = np.array(sys.stdin.readline().split(), dtype=np.int64)

def main():
    res = np.bincount(np.minimum(a // 400, 8), minlength=9)
    
    ans_min = np.count_nonzero(res[:8])
    ans_max = ans_min + res[8]
    if ans_min == 0:
        ans_min = 1
 
    return ans_min, ans_max

if __name__ == '__main__':
    ans = main()
    print(*ans, sep=' ')

Submission status: Accepted

Solution code:
color = [0 for i in range(8)]

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

p = 0
for a in al:
    if a < 3200:
        color[a//400] = 1
    else:
        p += 1
print(max(sum(color), 1))
print(sum(color) + p)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    over=0
    n=int(input())
    aa=LI()
    cnt=[0]*8
    for a in aa:
        if a>=3200:over+=1
        else:cnt[a//400]=1
    s=sum(cnt)
    print(max(1,s),s+over)

main()

Submission status: Accepted

Solution code:
ratings = [(400 * i - 1) for i in range(1, 9)]
present = [0 for i in range(1, 9)]
n = int(input())
a = list(map(int, input().split()))
hi = 0
for x in a:
	itr = 0
	while itr < len(ratings) and x > ratings[itr]:
		itr = itr + 1
	if (itr == len(ratings)):
		hi = hi + 1
	else:
		present[itr] = 1
sm = sum(present)
mn, mx = sm, sm + hi
if sm == 0:
	mn = 1
print("%d %d" % (mn, mx))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
c1 = c2 = c3 = c4 = c5 = c6 = c7 = c8 = c9 = 0
for i in range(n):
    if 1 <= a[i] < 400:
        c1 = 1
    elif 400 <= a[i] < 800:
        c2 = 1
    elif 800 <= a[i] < 1200:
        c3 = 1
    elif 1200 <= a[i] < 1600:
        c4 = 1
    elif 1600 <= a[i] < 2000:
        c5 = 1
    elif 2000 <= a[i] < 2400:
        c6 = 1
    elif 2400 <= a[i] < 2800:
        c7 = 1
    elif 2800 <= a[i] < 3200:
        c8 = 1
    else:
        c9 += 1
print(max(1, c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8),
      c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())
A = list(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

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

print('1' if ans == 0 else ans, end=' ')
print(ans + color[8])

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
color = [0] * 9
for p in a:
    if p >= 3200: color[8] += 1
    else: color[p // 400] += 1
small = len([c for c in color[0:8] if c > 0])
big = small + color[8]
if not small: small += 1
print(small, big)

Submission status: Accepted

Solution code:
import sys
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
maxA = max(A)
L=[0 for _ in range(9)]
for a in A:
    if a <=399:
        L[0]+=1
    elif a <=799:
        L[1]+=1
    elif a <=1199:
        L[2]+=1
    elif a <=1599:
        L[3]+=1
    elif a <=1999:
        L[4]+=1
    elif a <=2399:
        L[5]+=1
    elif a <=2799:
        L[6]+=1
    elif a <=3199:
        L[7]+=1
    else:
        L[8]+=1
cnt=0
for i in range(8):
    if L[i] !=0:
        cnt+=1
if cnt==0 and L[8]!=0:
    Min =1
else:
    Min = cnt
print(Min, cnt+L[8])

Submission status: Accepted

Solution code:
n = int(input())
l = [int(i) for i in input().split()]
ans = [0 for _ in range(9)]
free = 0
for i in l:
    if i < 3200:
        ans[i//400] += 1
    else:
        free += 1
        
ans = [i for i in ans if i != 0]
print(len(ans) if ans else 1,len(ans) + free)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
C = set()
R = 0
for a in A:
    c = a//400 if a<3200 else 8
    C.add(c)
    if c==8: R+=1

print(len(C) - min(1, R, len(C)-1), len(C) + max(0, R-1))

Submission status: Accepted

Solution code:
N = int(input())
L = [0 for i in range(9)]
S = list(map(int, input().split()))
for i in range(N):
  p = S[i] // 400
  if p <= 7:
    L[p] += 1
  else:
    L[8] += 1
Z, M, m = 0, 0, 0
for i in range(8):
  if L[i] == 0:
    Z += 1
  else:
    M += 1
    m += 1
M += L[8]
if m == 0 and L[8] != 0:
  m = 1
print(m, M)

Submission status: Accepted

Solution code:
# ABC064c
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
a = list(map(int, input().split()))
ans = 0
color = [False]*8
for i in a:
    if i >= 3200:
        ans += 1
        continue
    color[i//400] = True
print(max(color.count(True), 1), ans+color.count(True))

Submission status: Accepted

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

d = {"Gray": 0, "Brown": 0, "Green": 0, "Sky": 0, "Blue": 0, "Yellow": 0, "Orange": 0, "Red": 0}
f = 0

for i in range(N):
    s = A[i]
    if s <= 399:
        d["Gray"] += 1
    elif s >= 400 and s <= 799:
        d["Brown"] += 1
    elif s >= 800 and s <= 1199:
        d["Green"] += 1
    elif s >= 1200 and s <= 1599:
        d["Sky"] += 1
    elif s >= 1600 and s <= 1999:
        d["Blue"] += 1
    elif s >= 2000 and s <= 2399:
        d["Yellow"] += 1
    elif s >= 2400 and s <= 2799:
        d["Orange"] += 1
    elif s >= 2800 and s <= 3199:
        d["Red"] += 1
    elif s >= 3200:
        f += 1

MIN = 0
for v in d.values():
    if v > 0:
        MIN += 1

MAX = MIN + f

if MIN == 0 :
    MIN = 1

print(MIN, MAX)

Submission status: Accepted

Solution code:
n=int(input())
a=sorted(list(map(int,input().split())))
c=[0]*8
k=n
for i in range(n):
    for j in range(8):
        if 400*j<=a[i]<400*(j+1):
            c[j]=1
            break
    else:
        k=i
        break


d=c.count(1)
if d==0:
    print(1, end=" ")
else:
    print(d, end=" ")

print(d+(n-k))

Submission status: Accepted

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

min_color = 0
max_color = 0

cnt = 0

color = [0] * 8

for i in a:
    if i < 400 and color[0] == 0:
        min_color += 1
        max_color += 1
        color[0] = 1

    elif 400 <= i and i < 800 and color[1] == 0:
        min_color += 1
        max_color += 1
        color[1] = 1

    elif 800 <= i and i < 1200 and color[2] == 0:
        min_color += 1
        max_color += 1
        color[2] = 1

    elif 1200 <= i and i < 1600 and color[3] == 0:
        min_color += 1
        max_color += 1
        color[3] = 1

    elif 1600 <= i and i < 2000 and color[4] == 0:
        min_color += 1
        max_color += 1
        color[4] = 1

    elif 2000 <= i and i < 2400 and color[5] == 0:
        min_color += 1
        max_color += 1
        color[5] = 1

    elif 2400 <= i and i < 2800 and color[6] == 0:
        min_color += 1
        max_color += 1
        color[6] = 1

    elif 2800 <= i and i < 3200 and color[7] == 0:
        min_color += 1
        max_color += 1
        color[7] = 1

    elif i >= 3200:
        max_color += 1
        cnt += 1

if cnt == N:
    min_color = 1

print(min_color, max_color)

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
A = MAP()

norm = []
genius = []
for a in A:
	if a >= 3200: genius.append(a//400)
	else: norm.append(a//400)

#print(norm)
#print(genius)

print(len(set(norm)) if norm else 1, len(set(norm))+len(genius))

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
a = list(map(int, stdin.readline().rstrip().split()))

c = [0] * 9
for i in a:
    if i >= 3200:
        c[8] += 1
    else:
        for j in range(9):
            if 400 * j <= i <= 400 * j + 399:
                c[j] += 1

res = len([i for i in c[:-1] if i > 0])
print(1 if res == 0 else res, res + c[-1])

Submission status: Accepted

Solution code:
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    d = collections.defaultdict(int)
    for i in range(n):
        if 1 <= a[i] <= 399:
            d[0] += 1
        elif 400 <= a[i] <= 799:
            d[1] += 1
        elif 800 <= a[i] <= 1199:
            d[2] += 1
        elif 1200 <= a[i] <= 1599:
            d[3] += 1
        elif 1600 <= a[i] <= 1999:
            d[4] += 1
        elif 2000 <= a[i] <= 2399:
            d[5] += 1
        elif 2400 <= a[i] <= 2799:
            d[6] += 1
        elif 2800 <= a[i] <= 3199:
            d[7] += 1
        else:
            d[8] += 1
    print(len(d) if 8 not in d else 1 if len(d) == 1 else len(d) - 1, len(d) if 8 not in d else len(d) + d[8] - 1)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
N, A = int(input()), list(map(int, input().split()))
C = [a // 400 for a in A]
mini = sum([1 for c in range(8) if c in C])
print(max(mini, 1), mini + sum([1 for c in C if c >= 8]))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
colorSet = set()
minAns = 0
maxAns = 0
cnt = 0

for i in range(n):
    color = a[i] // 400
    if color < 8:
        colorSet.add(color)
    else:
        colorSet.add(8)

    if color >= 8:
        cnt += 1

#print(colorSet)

if len(colorSet) > 1 and any(item >= 8 for item in colorSet):
    minAns = len(colorSet) - 1
else:
    minAns = len(colorSet)

if cnt > 0:
    # maxAns = min(len(colorSet) - 1 + cnt, 8)
    maxAns = len(colorSet) - 1 + cnt
else:
    maxAns = len(colorSet)

print(minAns, maxAns)

Submission status: Accepted

Solution code:
import bisect
N = int(input())
a = sorted(list(map(int, input().split())))
color = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
border = []
for i in color:
    border.append(bisect.bisect_left(a, i))
border = [0] + border
num = []
for i in range(len(color)):
    num.append(border[i+1] - border[i])
num.append(N - sum(num))
colornum = sum(x>0 for x in num[:-1])
print(str(max(1, colornum)) + " " + str(colornum + num[-1]))

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
col = [0]*8
wild = 0
for i in a:
    if i//400 <= 7:
        col[i//400] = 1
    else:
        wild += 1
minimum = max(1,sum(col))
maximum = sum(col)+wild
print(minimum,maximum)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
num = [0 for i in range(9)]
for i in range(N):
    if a[i] < 3200:
        num[a[i]//400] += 1
    else:
        num[-1] += 1

if num[-1] == 0:
    num = [i for i in num if i != 0]
    print(len(num),len(num))
else:

    n = num.pop(-1)

    num2 = [i for i in num if i != 0]
    print(max(1,len(num2)),len(num2)+n)

Submission status: Accepted

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

color = [0]*9
for i in range(n):
    if 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
    else:
        color[8] += 1

k = len(list(filter(lambda x: x > 0, color[:-1])))
print(1 if k == 0 else k, k + color[-1])

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))
c = [False] * 8
red = 0
for i in range(n):
    if l[i] <= 399:
        c[0] = True
    elif l[i] <= 799:
        c[1] = True
    elif l[i] <= 1199:
        c[2] = True
    elif l[i] <= 1599:
        c[3] = True
    elif l[i] <= 1999:
        c[4] = True
    elif l[i] <= 2399:
        c[5] = True
    elif l[i] <= 2799:
        c[6] = True
    elif l[i] <= 3199:
        c[7] = True
    else:
        red += 1
ans_min = max(1, c.count(True))
ans_max = c.count(True) + red
print(ans_min, ans_max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
cnt = [0,0,0,0,0,0,0,0]
count = 0
num = 0

for i in a:
    if 1 <= i <= 399:
        cnt[0] += 1
    elif 400<= i <= 799:
        cnt[1] += 1
        
    elif 800<= i <= 1199:
        cnt[2] += 1
        
    elif 1200<= i <= 1599:
        cnt[3] += 1
        
    elif 1600<= i <= 1999:
        cnt[4] += 1
        
    elif 2000<= i <= 2399:
        cnt[5] += 1
        
    elif 2400<= i <= 2799:
        cnt[6] += 1
       
    elif 2800 <= i <= 3199:
        cnt[7] += 1
        
    else:
        count += 1
for i in range(len(cnt)):
    if cnt[i] > 0:
        num +=1
if num == 0:
    num += 1
    print(num,num+count-1)
    exit()
print(num,num+count)

Submission status: Accepted

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

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

color1 = 0
color2 = 0
for i in dct.items():  
  if (i[0] == 8):
    color2 = i[1]
  else:
    if (i[1] > 0):
      color1 += 1

ans1 = color1
ans2 = color1+color2
if (color1 == 0):
  ans1 = 1
print(ans1,ans2)

Submission status: Accepted

Solution code:
N = int(input())
rate = [False] * 8
a = list(map(int,input().split()))
a.sort()
CntOver3200 = 0

for i in range(N):
    if a[i] >= 3200:
        CntOver3200 = N - i
        break
    rate[a[i] // 400] = True
min_val = max(sum(rate) , 1)
if any(rate):
    max_val = min_val + CntOver3200
else:
    max_val = CntOver3200
print(min_val , max_val)

Submission status: Accepted

Solution code:
n = int(input())
#n, k = map(int,input().split())

plst = [int(i) for i in input().split()]
lst = [0] * 8
kami = 0
for i in plst:
    l = i // 400
    if l >= 8:
        kami += 1
    else:
        lst[l] = 1
s = sum(lst)
print(max(s, 1), s + kami)

Submission status: Accepted

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

d=0
for i in range(8):
    if c[i]==1:
        d+=1
if d==0:
    print(1, end=" ")
else:
    print(d, end=" ")


#問題文を完全に読み違えた
print(d+(n-k))

Submission status: Accepted

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

d=0
for i in range(8):
    if c[i]==1:
        d+=1
if n==1 or d==0:
    print(1, end=" ")
else:
    print(d, end=" ")

if n==1:
    print(1)
elif k==-1:
    print(d)
else:
    print(d+(n-k))

Submission status: Accepted

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

def check(n):
    if(n<400):
        color='ash'
    elif(n<800):
        color='brown'
    elif(n<1200):
        color='green'
    elif(n<1600):
        color='water'
    elif(n<2000):
        color='blue'
    elif(n<2400):
        color='yellow'
    elif(n<2800):
        color='orange'
    elif(n<3200):
        color='red'
    else:
        color='free'
    return color
c=[]
r=0
for i in a:
    color=check(i)
    if(color not in c and color!='free'):
        c.append(color)
    elif(color=='free'):
        r+=1
print(max(len(c),1),len(c)+r)

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
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
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    A=LI()
    cnt = 0
    col = set()
    for a in A:
        if a>=3200:
            cnt += 1
        else:
            col.add(a//400)
    print(max(1,len(col)), len(col)+cnt)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

l = [0] * 9

for i in range(n):
    s = min(a[i] // 400, 8)
    l[s] += 1

m = 0
for i in range(len(l) - 1):
    if l[i] != 0:
        m += 1

print(max(m, 1), l[-1] + m)

Submission status: Accepted

Solution code:
n = int(input())
s = set()
c = 0
for i in map(int, input().split()):
  if i >= 3200:
    c += 1
  else:
    s.add(i//400)
print(max(1, len(s)), len(s)+c)

Submission status: Accepted

Solution code:
# ABC64C
n = int(input())
a = list(map(int,input().split()))
b = set()
d = 0
for i in a:
    c = i // 400
    if c < 8:
        b.add(c)
    else:
        d += 1
print(max(len(b),1),len(b)+d)

Submission status: Accepted

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

def CheckColor(a, count):
    if 1 <= a and a <= 399:
        count[0] += 1
    elif 400 <= a and a <= 799:
        count[1] += 1
    elif 800 <= a and a <= 1199:
        count[2] += 1
    elif 1200 <= a and a <= 1599:
        count[3] += 1
    elif 1600 <= a and a <= 1999:
        count[4] += 1
    elif 2000 <= a and a <= 2399:
        count[5] += 1
    elif 2400 <= a and a <= 2799:
        count[6] += 1
    elif 2800 <= a and a <= 3199:
        count[7] += 1
    else:
        count[8] += 1

ans = 0
count = [0 for _ in range(9)]

for a in A:
    CheckColor(a, count)

for c in count[:8]:
    if c != 0:
        ans += 1

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

Submission status: Accepted

Solution code:
N = int(input())
color = [0]*8
free = 0
A = list(map(int,input().split()))
for a in A:
    if 1<=a<=399:
        color[0] = 1
    elif 400<=a<=799:
        color[1] = 1
    elif 800<=a<=1199:
        color[2] = 1
    elif 1200<=a<=1599:
        color[3] = 1
    elif 1600<=a<=1999:
        color[4] = 1
    elif 2000<=a<=2399:
        color[5] = 1
    elif 2400<=a<=2799:
        color[6] = 1
    elif 2800<=a<=3199:
        color[7] = 1
    else:
        free += 1
maxcolor = sum(color)+free
mincolor = max(sum(color),1)
print(mincolor,maxcolor)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
cnt1 = cnt2 = cnt3 = cnt4 = cnt5 = cnt6 = cnt7 = cnt8 = cnt9 = 0
for num in a:
  if 1<=num<400:
    cnt1 += 1
  elif 400<=num<800:
    cnt2 += 1
  elif 800<=num<1200:
    cnt3 += 1 
  elif 1200<=num<1600:
    cnt4 += 1   
  elif 1600<=num<2000:
    cnt5 += 1 
  elif 2000<=num<2400:
    cnt6 += 1
  elif 2400<=num<2800:
    cnt7 += 1
  elif 2800<=num<3200:
    cnt8 += 1
  else:
    cnt9 += 1
cnt = [cnt1,cnt2,cnt3,cnt4,cnt5,cnt6,cnt7,cnt8]

ans = 0
for c in cnt:
  if c != 0:
    ans += 1

print(max(ans,1),ans+cnt9)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int,input().split()))
C = set()
d = 0
for a in A:
  c = a // 400
  if c < 8: C.add(c)
  else:
    d += 1
print(max(len(C),1),min(n,len(C) + d))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
wild_cnt = 0
colors = []
for i in a:
  if 1 <= i <= 399:
    colors.append("g")
  elif 400 <= i <= 799:
    colors.append("br")
  elif 800 <= i <= 1199:
    colors.append("gr")
  elif 1200 <= i <= 1599:
    colors.append("wa")
  elif 1600 <= i <= 1999:
    colors.append("bl")
  elif 2000 <= i <= 2399:
    colors.append("y")
  elif 2400 <= i <= 2799:
    colors.append("o")
  elif 2800 <= i <= 3199:
    colors.append("r")
  elif 3200 <= i:
    wild_cnt += 1
# 3200以上しか存在しない場合
if len(set(colors)) == 0:
  print(str(1) + " " + str(min(n,wild_cnt)))
else:
  print(str(len(set(colors)))+ " " +str(min(n,len(set(colors)) + wild_cnt)))

Submission status: Accepted

Solution code:
N = int(input())

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

color = [0] * 8

a = 400 
free = 0
    
for i in range(0,N):
    if rate[i] < a:
        color[0] = 1
    elif a <= rate[i] < 2*a:
        color[1] = 1
    elif 2*a <= rate[i] < 3*a:
        color[2] = 1
    elif 3*a <= rate[i] < 4*a:
        color[3] = 1
    elif 4*a <= rate[i] < 5*a:
        color[4] = 1
    elif 5*a <= rate[i] < 6*a:
        color[5] = 1
    elif 6*a <= rate[i] < 7*a:
        color[6] = 1
    elif 7*a <= rate[i] < 8*a:
        color[7] = 1
    elif 8*a <= rate[i]:
        free += 1
        

min_color = 0
max_color = 0

min_color = color.count(1)
max_color = min_color + free

print( max(min_color,1), max_color)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
lin = [0]*9

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

mi = lin[:-1].count(1)
ma = mi+lin[-1]
if mi == 0:
    mi = 1
print(mi,ma)

Submission status: Accepted

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

b=[ai//400 for ai in a]

ans=0
for i in range(8):
    if i in b:
        ans+=1

m=sum([b.count(i) for i in range(8,13)])

print(ans if ans else 1,ans+m)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
C = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
A_class = []
free_color = 0
from bisect import bisect_right
for a in A:
  cls = bisect_right(C, a)
  if cls == 8:
    free_color += 1
  else:
    A_class.append(cls)
#print(A_class, free_color)
max_class = len(set(A_class)) + free_color
min_class = max(len(set(A_class)), 1)
print(min_class, max_class)

Submission status: Accepted

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

licol = [0]*9
for i in range(n):
  if li[i]//400 <= 7:
    licol[li[i]//400] += 1
  else:
    licol[8] += 1
ans = 0
for i in range(8):
  if licol[i] != 0:
    ans += 1
if ans == 0:
  print(1,end=" ")
else:
  print(ans,end=" ")
print(ans+licol[8])

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    C=[0]*9
    n=int(input())
    for a in map(int,input().split()):
        s=a//400
        if(s>=8): C[8]+=1
        else: C[s]+=1

    cnt=sum(1 for i in range(8) if(C[i]))
    print(max(1,cnt),cnt+C[-1])
resolve()

Submission status: Accepted

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

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

iro=[0]*8
free=0
for i in range(n):
    if a[i]>=3200:
        free+=1
    else:
        iro[a[i]//400]+=1
print(max(1,8-iro.count(0)),8-iro.count(0)+free)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
c=0
for i in range(n):
    if A[i]>=3200:
        c+=1
        A[i]=8
    else:
        A[i]//=400
m=len(set(A))
if c:
    if m==1:
        print(1,c)
    else:
        print(m-1,m-1+c)
else:
    print(m,m)

Submission status: Accepted

Solution code:
N = int(input())
array = list(map(int,input().split()))
hai = []
tya = []
midori = []
mizu = []
ao = []
ki = []
dai = []
aka = []
mu = []
for i in array:
    if i <= 399:
        hai.append(i)
        continue
    if i <= 799:
        tya.append(i)
        continue
    if i <= 1199:
        midori.append(i)
        continue
    if i <= 1599:
        mizu.append(i)
        continue
    if i <= 1999:
        ao.append(i)
        continue
    if i <= 2399:
        ki.append(i)
        continue
    if i <= 2799:
        dai.append(i)
        continue
    if i <= 3199:
        aka.append(i)
        continue
    mu.append(i)
ans = 0
if len(hai) != 0:
    ans += 1
if len(tya) != 0:
    ans += 1
if len(midori) != 0:
    ans += 1
if len(mizu) != 0:
    ans += 1
if len(ao) != 0:
    ans += 1
if len(ki) != 0:
    ans += 1
if len(dai) != 0:
    ans += 1
if len(aka) != 0:
    ans += 1
ans_min = max(ans,1)
ans_max = ans + len(mu)
print(ans_min,ans_max)

Submission status: Accepted

Solution code:
L = [["A", 1, 399],
	["B", 400, 799],
	["C", 800, 1199],
	["D", 1200, 1599],
	["E", 1600, 1999],
	["F", 2000, 2399],
	["G", 2400, 2799],
	["H", 2800, 3199],
    ["I", 3200, 4800]]

N = int(input())
P = [int(i) for i in input().split()]
C = []

cnt_I = 0
for i in P:
  if i >= 3200:
    cnt_I += 1
  for c, m, x in L:
      if m <= i and i <= x:
        C.append(c)
        break
        
if "I" in C:
  mx = len(set(C)) - 1 + cnt_I
  mn = len(set(C)) - 1
  if mn == 0:
    mn = 1
else:
  mx = len(set(C))
  mn = len(set(C))

print(mn, mx)

Submission status: Accepted

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

d = [0, 0, 0, 0, 0, 0, 0, 0, 0]


for i in a:
  if i < 400:
    d[0] = 1
    continue
  elif i < 800:
    d[1] = 1
  elif i < 1200:
    d[2] = 1
  elif i < 1600:
    d[3] = 1
  elif i < 2000:
    d[4] = 1
  elif i < 2400:
    d[5] = 1
  elif i < 2800:
    d[6] = 1
  elif i < 3200:
    d[7] = 1
  else:
    d[8] += 1
    
min = sum(d[:-1])
if min == 0:
  min = 1
max = sum(d)
print(min, max)