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 = [int(_) for _ in input().split()]
color = [False]*8
overnum = 0

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

print(max(1, color.count(True)), color.count(True)+overnum)

Submission status: Accepted

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

num = 0
diff = colors[8]
for i in range(8):
    if colors[i]:
        num += 1
print(max(num,1), num + diff)

Submission status: Accepted

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

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

for i in A:
    if 1 <= i <= 399:
        L[0] += 1
    if 400 <= i <= 799:
        L[1] += 1
    if 800 <= i <= 1199:
        L[2] += 1
    if 1200 <= i <= 1599:
        L[3] += 1
    if 1600 <= i <= 1999:
        L[4] += 1
    if 2000 <= i <= 2399:
        L[5] += 1
    if 2400 <= i <= 2799:
        L[6] += 1
    if 2800 <= i <= 3199:
        L[7] += 1
    if 3200 <= i:
        L[8] += 1
        
count_0 = L[0:8].count(0)
count_not_0 = 8 - count_0
count_strong = L[8]

if count_not_0 == 0:
    if count_strong >= 1:
        print(1, count_strong,)
    else:
        print(0, 0)
else:
    if count_strong == 0:
        print(count_not_0, count_not_0)
    else:
        print(count_not_0, count_not_0 + count_strong)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
color = [0]*9
for i in a:
  color[min(8,i//400)] += 1
kind = 0
for i in color[:8]:
  if i:
    kind += 1
if kind == 0 and color[8]:
  color[8] -= 1
  kind += 1
print(kind,kind+color[8])

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
gray=[]
brown=[]
green=[]
skyblue=[]
blue=[]
yellow=[]
orange=[]
red=[]
for i in range(1,3200):
    if 0<i<400:
        gray.append(i)
    elif 399<i<800:
        brown.append(i)
    elif 799<i<1200:
        green.append(i)
    elif 1299<i<1600:
        skyblue.append(i)
    elif 1599<i<2000:
        blue.append(i)
    elif 1999<i<2400:
        yellow.append(i)
    elif 2399<i<2800:
        orange.append(i)
    else:
        red.append(i)
collor=[gray,brown,green,skyblue,blue,yellow,orange,red]
ans0=0
for i in range(len(collor)):
    if len(set(collor[i])&set(a))!=0:
        ans0+=1
cnt=0
for x in a:
    if x>=3200:
        cnt+=1
if ans0!=0:
    print(ans0,ans0+cnt)
else:
    print(1,ans0+cnt)

Submission status: Accepted

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

count = 0
for i in range(8):
    if len(list(filter(lambda x:i*400<=x and x<400*(i+1), a))) > 0:
        count+=1

x = len(list(filter(lambda x:3200<=x, a)))
if count==0:
    count=1
    x-=1

print("{} {}".format(count, count+x))

Submission status: Accepted

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

x = []
f = 0
for a in A:
    if a//400 < 8:
        x.append(a//400)
    else:
        f += 1
x = set(x)
l = len(x)
print(max(l,1),l+f)

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split());b=[s//400for s in a if s<3200];c=len(set(b));print(c or 1,n-len(b)+c)

Submission status: Accepted

Solution code:
#064-C
n=int(input())
A=list(map(int,input().split()))
s=set()
cnt=0
for a in A:
    c=a//400
    if c>=8:
        cnt+=1
    else:
        s.add(c)
m=len(s)
if m:
    M=m+cnt
else:
    m=1
    M=cnt
print(m,M)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    colors = [0] * 9
    for i in range(N):
        c = min(A[i] // 400, 8)
        colors[c] += 1
    tmp = 0
    for i in range(8):
        if colors[i] >= 1:
            tmp += 1
    mn = max(tmp, 1)
    mx = tmp + colors[8]
    print(mn, mx)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

check = set()
free = 0
for a in A:
  x = (a-a%400)//400
  if(x < 8):
    check.add(x)
  else:
    free += 1
c = len(check) 
if(c == 0):
  print(1, free)
else:
  print(c, c+free)

Submission status: Accepted

Solution code:
#ABC064C
N=int(input())
A=[0 for i in range(9)]
C=[1,700,800,1200,1600,2000,2400,2800,3200][::-1]
for a in list(map(int,input().split())):
	for i in range(9):
		if C[i]<=a:
			A[8-i]+=1
			break
print(8-A[:-1].count(0)+(A[:-1].count(0)==8),8-A[:-1].count(0)+A[8])

Submission status: Accepted

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

colors = [0]*9

for rate in rates:
    if rate < 3200:
        colors[rate // 400] += 1
    else:
        colors[8] += 1

zeros = colors[0:8].count(0)
nonzeros = 8 - zeros

M = nonzeros + colors[8]

if nonzeros == 0:
    m = 1
else:
    m = nonzeros

print(m, M)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
f = [0]
for i in range(1,400):
    f.append(0)
for i in range(400,800):
    f.append(1)
for i in range(800,1200):
    f.append(2)
for i in range(1200,1600):
    f.append(3)
for i in range(1600,2000):
    f.append(4)
for i in range(2000,2400):
    f.append(5)
for i in range(2400,2800):
    f.append(6)
for i in range(2800,3200):
    f.append(7)
for i in range(3200,4801):
    f.append(-1)
n = I()
a = LI()
k = [1 for i in range(8)]
s = 0
t = 0
for i in a:
    if f[i] >= 0:
        if k[f[i]]:
            k[f[i]] = 0
            s += 1
    else:
        t += 1
print(max(s,1),min(s+t,n))
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

Solution code:
def main():
    _ = int(input())
    a = [int(s) for s in input().split()]
    print(*solve(a))

def solve(a):
    s = set()
    t = 0
    f = 0

    for x in a:
        y = x // 400
        if x >= 3200:
            t += 1
            f = 1
        else:
            s.add(y)
    
    mi = max(len(s), f)
    ma = len(s) + t
    return mi, ma

main()

Submission status: Accepted

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

counts = [0]*9

for i in A:
    color = int(i/400)
    if color > 8:
        color = 8
    counts[color] += 1

#print(counts)

v = 8 - counts[:-1].count(0)

if counts[-1] == 0:
    print(v,v)
else:
    if v == 0:
        print(1,counts[-1])
    else :
        print(v,v+counts[-1])

Submission status: Accepted

Solution code:
from collections import Counter

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

sum=0
b=[]
for a in A:
    a//=400
    if a<8:
        b.append(a)
    else:
        sum+=1
b=Counter(b).most_common()
m=len(b)
if m==0:
    x=1
else:
    x=m
y=m+sum
print(x,y)

Submission status: Accepted

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

d = [0 for _ in range(9)]
for x in a:
    p = x // 400
    if p >= 8:
        d[8] += 1
    else:
        d[p] = 1
        
if sum(d) == d[8]:
    print(1, d[8])
else:
    print(sum(d) - d[8], sum(d))

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
color=[0]*8
over=0
for i in range(n):
    if a[i]<=399:
        color[0]+=1
    elif a[i]<=799:
        color[1]+=1
    elif a[i]<=1199:
        color[2]+=1
    elif a[i]<=1599:
        color[3]+=1
    elif a[i]<=1999:
        color[4]+=1
    elif a[i]<=2399:
        color[5]+=1
    elif a[i]<=2799:
        color[6]+=1
    elif a[i]<=3199:
        color[7]+=1
    else:
        over+=1
mini=8-color.count(0) if (8-color.count(0))>0 else 1
maxi=8-color.count(0)+over
print("{} {}".format(mini,maxi))

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split());b=[s//400for s in a if s<3200];c=len(set(b));print(max(c,1),n-len(b)+c)

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split());b=[s//400 for s in a if s<3200];c=len(set(b));print(max(c,1),n-len(b)+c)

Submission status: Accepted

Solution code:
n=int(input());b=[s//400 for s in map(int,input().split()) if s<3200];c=len(set(b));print(max(c,1),n-len(b)+c)

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
b=[s//400 for s in a if s<3200]
c=len(set(b))
print(max(c,1),n-len(b)+c)

Submission status: Accepted

Solution code:
import bisect
N = int(input())
A = [int(i) for i in input().split()]
rank = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
memo = [0] * 9

for i in range(N):
    if A[i] >= 3200:
        memo[8] += 1
    else:
        memo[bisect.bisect_right(rank, A[i])] = 1
    
color = sum(memo[:8])
minc = max(color, 1)
maxc = color + memo[8]

print(minc, maxc)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
RATE_RANGE = 400
TOTAL_COLOR_NUM = 8
MAX_RATE = 3200
N = input()
a = map(int, raw_input().split())
# discretize rate (0 ~ 8)
rainbow_color_num = 0
kind_num = set()
for _a in a:
  if _a >= MAX_RATE:
    rainbow_color_num += 1
  else:
    kind_num.add(_a / RATE_RANGE)
print max(1, len(kind_num)), len(kind_num) + rainbow_color_num

Submission status: Accepted

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

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

from collections import defaultdict
from bisect import bisect_right

ans = 0
gold = 0
dic = defaultdict(int)
for i in range(N):
    r = bisect_right(co, A[i])
    dic[r] += 1
    
gold = dic[9]
del dic[9]
ans = len(dic.keys())

if ans == 0:
    # print(1, min(gold, 8))
    print(1, gold)
else:
    # print( ans  , min(ans+gold, 8) )
    print( ans  , ans+gold )
# print(dic)

Submission status: Accepted

Solution code:
N  = int(input())
using = [0 for _ in range(9)]
def color(i):
    i = int(i)
    if i < 400:
        return 0
    elif i< 800:
        return 1
    elif i<1200:
        return 2
    elif i<1600:
        return 3
    elif i<2000:
        return 4
    elif i<2400:
        return 5
    elif i<2800:
        return 6
    elif i<3200:
        return 7
    else:
        return 8
L = list(map(color, input().split()))
for x in L:
    using[x] += 1
val = using.pop(-1)
if list(filter(lambda x:x!=0,using)) == []:
    print(1,val)
else:
    minimum = len(list(filter(lambda x:x!=0,using)))
    maximum =  minimum + val
    print(minimum,maximum)

Submission status: Accepted

Solution code:
def rate(n):
    if n <= 399:
        return "gray"
    elif n <= 799:
        return "brown"
    elif n <= 1199:
        return "green"
    elif n <= 1599:
        return "water"
    elif n <= 1999:
        return "blue"
    elif n <= 2399:
        return "yellow"
    elif n <= 2799:
        return "orange"
    elif n <= 3199:
        return "red"
    else:
        return "pro"

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

for i in a:
    ans.append(rate(i))

pro = ans.count("pro")
ANS = set(ans)
ANS.discard("pro")
MIN = len(ANS)
MAX = MIN + pro

print(max(MIN, 1), MAX)

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
c=0
l2=[0]*9
for i in l:
  if 1<=i and i<=399:
    if l2[0]==0:
      c+=1
      l2[0]=1
  elif 400<=i and i<=799:
    if l2[1]==0:
      c+=1
      l2[1]=1
  elif 800<=i and i<=1199:
    if l2[2]==0:
      c+=1
      l2[2]=1
  elif 1200<=i and i<=1599:
    if l2[3]==0:
      c+=1
      l2[3]=1
  elif 1600<=i and i<=1999:
    if l2[4]==0:
      c+=1
      l2[4]=1
  elif 2000<=i and i<=2399:
    if l2[5]==0:
      c+=1
      l2[5]=1
  elif 2400<=i and i<=2799:
    if l2[6]==0:
      c+=1
      l2[6]=1
  elif 2800<=i and i<=3199:
    if l2[7]==0:
      c+=1
      l2[7]=1
  else:
    c+=1
    l2[8]+=1
if c==9:
  print(8,8)
else:
  if l2[8]!=0:
    if l2[8]==c:
      print(1,min(c,8))
    else:
      print(c-l2[8],c)
  else:
    print(c,c)

Submission status: Accepted

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

Submission status: Accepted

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

tmp = []
nine = 0
for a in A:
  check = (a - a%400)//400
  if(check < 8):
    tmp.append(check)
  else:
    nine += 1
color = len(list(set(tmp)))
if(color == 0):
  print(1, nine)
else:
  print(color, color+nine)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

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

a.sort()
c = 0
ans = 0
vc = 0
for ai in a:
    if 0<=ai and ai <400 and c<1:
        ans+=1
        c=1
    elif 400<=ai and ai<800 and c<2:
        ans+=1
        c=2
    elif 800<=ai and ai<1200 and c<3:
        ans+=1
        c=3
    elif 1200<=ai and ai<1600 and c<4:
        ans+=1
        c=4
    elif 1600<=ai and ai<2000 and c<5:
        ans+=1
        c=5
    elif 2000<=ai and ai<2400 and c<6:
        ans+=1
        c=6
    elif 2400<=ai and ai<2800 and c<7:
        ans+=1
        c=7
    elif 2800<=ai and ai<3200 and c<8:
        ans+=1
        c=8
    elif 3200<=ai:
        vc+=1

if ans!=0:
    print("{} {}".format(ans, ans+vc))
else:
    print("{} {}".format(1, ans+vc))

Submission status: Accepted

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

dic = defaultdict(int)
for a in A:
    n = a//400
    if n > 7:
        dic[8] += 1
    else: dic[n] += 1

m = len(dic.keys())
if dic[8] > 0:
    m -= 1
    mi = max(1,m)
    ma = m+dic[8]
else:
    mi = ma = m
print(mi,ma)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
color_count = [0 for i in range(8)]
tourist = 0
for i in range(N):
    if a[i] >= 3200:
        tourist += 1
    else:
        A = int(a[i]/400)
        if color_count[A]!=1:
            color_count[A]+=1
        else:
            pass
MIN = sum(color_count)
if MIN != 0:
    print(MIN,(MIN+tourist))
else:
    print(1,tourist)

Submission status: Accepted

Solution code:
n=int(input())
a_s=list(map(int,input().split()))
color_list=[0]*8
god=0
point_split=[1,400,800,1200,1600,2000,2400,2800,3200]
for a in a_s:
    for i in range(8):
        if point_split[i]<=a<point_split[i+1]:
            color_list[i]+=1
    if a >=3200:
        god+=1

ans=0
for color in color_list:
    if color:
        ans+=1
max=ans+god
if ans==0:
    min=1
else:
    min=ans

print(min,max)

Submission status: Accepted

Solution code:
# いやいやいやいやいやいやいや

# え何 もしかして色って最大8色とはどこにもかいてありませ〜〜〜んとかいうオチ？
# > 4人目が「紫色」を選び、5人目が「黒色」を選んだ時、色の種類数は5であり、これは最大値を取る一つの例である
# まじかよ...

n = int(input())
arr = list(map(int, input().split()))
over = 0
collection = [False for _ in range(8)]
for a in arr:
    c = a // 400
    if c >= 8:
        over += 1
    else:
        collection[c] = True
maximum = sum(filter(lambda x: x is True, collection)) + over
minimum = max(1, sum(filter(lambda x: x is True, collection)))
print(minimum, maximum)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
A=list(map(lambda x:x//400 if x<3200 else 8,A))
n_red=A.count(8)
red_exist=1 if n_red else 0
n_min=len(set(A)) if not red_exist else len(set(A))-1
print(1 if not n_min else n_min,n_min+n_red)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
A=list(map(lambda x:x//400 if x<3200 else 8,A))
n_red=A.count(8)
red_exist=1 if n_red else 0
red_only=1 if red_exist and len(list(set(A)))==1 else 0
n_min=len(set(A)) if not red_exist else len(set(A))-1
print(1 if red_only else n_min,n_min+n_red)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
A=list(map(lambda x:x//400 if x<3200 else 8,A))
n_red=A.count(8)
n_min=len(set(A))
n_8=1 if n_red else 0
print(1 if n_min==1 and list(set(A))[0]==8 else n_min-n_8,n_min+n_red-n_8)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
color=[0]*8
free=0
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
    elif 3200<=a<=4800:free+=1
M=sum(color)+free
m=1 if sum(color)==0 and free!=0 else sum(color)
print(m,M)

Submission status: Accepted

Solution code:
N = int(input())
c = [0]*8
d = 0
for ai in map(int,input().split()):
    if ai <400:
        c[0]=1
    elif 400<= ai <800:
        c[1]=1
    elif 800<= ai <1200:
        c[2]=1
    elif 1200<= ai <1600:
        c[3]=1
    elif 1600<= ai <2000:
        c[4]=1
    elif 2000<= ai <2400:
        c[5]=1
    elif 2400<= ai <2800:
        c[6]=1
    elif 2800<= ai <3200:
        c[7]=1
    elif 3200<= ai:
        d +=1

min_ans=0
for i in c:
    min_ans +=i

max_ans = min_ans + d

if min_ans == 0:
    min_ans = 1

print(min_ans,max_ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
color = [0 for _ in range(9)]
for item in a:
    if item <= 399:
        color[0] = True
    elif 400 <= item <= 799:
        color[1] = True
    elif 800 <= item <= 1199:
        color[2] = True
    elif 1200 <= item <= 1599:
        color[3] = True
    elif 1600 <= item <= 1999:
        color[4] = True
    elif 2000 <= item <= 2399:
        color[5] = True
    elif 2400 <= item <= 2799:
        color[6] = True
    elif 2800 <= item <= 3199:
        color[7] = True
    else:
        color[8] += 1

m = color[:8].count(True)
M = m + color[8]
if m:
    print(m, M)
else:
    print(1, M)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int,input().split()))
color = []
cnt = 0

for i in range(n):
    c = A[i]//400
    if c<=7:
        color.append(c)
    else:
        cnt += 1

diff = set(color)
minimum = max(len(diff),1)
maximum = len(diff)+cnt

print(minimum, maximum)

Submission status: Accepted

Solution code:
n = int(input())
a = sorted(map(int, input().split()))
cnt = 0

for k in range(1, 9):
    b = list(filter(lambda x: x < 400*k, a))
    if b:
        cnt += 1
    a = a[len(b):]
if cnt:
    print(cnt, cnt+len(a))
else:
    print(1, len(a))

Submission status: Accepted

Solution code:
from sys import stderr, setrecursionlimit
setrecursionlimit(2147483647)
def getInt():
    return int(input())
def getInts():
    return [int(i) for i in input().split()]
def getIntLines(n=1):
    res = []
    for _ in range(n):
        res.append(getInt())
    return res
def getIntsLines(n=1):
    res = []
    for _ in range(n):
        res.append(getInts())
    return res
def debug(*args, **kwargs):
    print(*args, file=stderr, **kwargs)

n = getInt()
a = getInts()
colors = [0, 0, 0, 0, 0, 0, 0, 0, 0]
for rate in a:
    if rate <= 399:
        colors[0] += 1
    elif rate <= 799:
        colors[1] += 1
    elif rate <= 1199:
        colors[2] += 1
    elif rate <= 1599:
        colors[3] += 1
    elif rate <= 1999:
        colors[4] += 1
    elif rate <= 2399:
        colors[5] += 1
    elif rate <= 2799:
        colors[6] += 1
    elif rate <= 3199:
        colors[7] += 1
    else:
        colors[8] += 1

monocolors = len(list(filter(lambda x:x!=0,colors[:-1])))
if monocolors == 0:
    print(1, colors[8])
else:
    print(monocolors, monocolors + colors[8])

Submission status: Accepted

Solution code:
def colormap(rate):
    if 1 <= rate < 400:
        return 0
    elif 400 <= rate < 800:
        return 1
    elif 800 <= rate < 1200:
        return 2
    elif 1200 <= rate < 1600:
        return 3
    elif 1600 <= rate < 2000:
        return 4
    elif 2000 <= rate < 2400:
        return 5
    elif 2400 <= rate < 2800:
        return 6
    elif 2800 <= rate < 3200:
        return 7
    elif 3200 <= rate:
        return -1


def solve():
    N = int(input())
    a = [int(x) for x in input().split()]

    colors = [colormap(x) for x in a]

    import collections
    count = collections.Counter(colors)
    # print(count)

    ncolor = len(count) - (-1 in count)

    nmin = 1 if ncolor == 0 else ncolor
    nmax = ncolor + count[-1]

    print(nmin, nmax)


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Accepted

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

se = set()
high = 0
for a in li:
    if a // 400 <= 7:
        se.add(a // 400)
    else:
        high += 1

print(max(1, len(se)), len(se) + high)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
color = [False] * 8
over3200 = 0
for a in A:
    for i in range(8):
        if a < 400*(i+1):
            color[i] = True
            break
    else:
        over3200 += 1
if sum(color):
    print(sum(color), end=' ')
    print(sum(color) + over3200)
else:
    print(1, end=' ')
    print(over3200)

Submission status: Accepted

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

B = set()
crown = 0
for i in range(n):
    x = A[i] // 400
    if x < 8:
        B.add(x)
    else:
        crown += 1
        
print(1 if len(B) == 0 else len(B), len(B) + crown)

Submission status: Accepted

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

B = set()
crown = 0
for a in A:
    if a // 400 >= 8:
        crown += 1
    else:
        B.add(a // 400)

print(max(1, len(B)), len(B) + crown)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def main():
    n = int(input())
    an = list(map(int, input().split()))
    colors = [color(a) for a in an]
    mi = max(1, count_colors(colors))
    ma = count_colors(colors) + free_players(colors)
    print(mi, ma)

def color(r):
    assert 1 <= r <= 4800
    if r < 400:
        return "grey"
    elif r < 800:
        return "brown"
    elif r < 1200:
        return "green"
    elif r < 1600:
        return "sky"
    elif r < 2000:
        return "blue"
    elif r < 2400:
        return "yellow"
    elif r < 2800:
        return "orange"
    elif r < 3200:
        return "red"
    else:
        return "free"

def count_colors(colors):
    res = set(colors)
    res -= {"free"}
    return len(res)

def free_players(colors):
    res = 0
    for c in colors:
        if c == "free":
            res += 1
    return res

main()

Submission status: Accepted

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

l = [0]*8
over = 0
for r in rates:
    if r >= 3200:
        over += 1
    else:
        l[r//400] += 1

col_num = len(list(filter(lambda x: x > 0, l)))

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

Submission status: Accepted

Solution code:
colors = [0 for i in range(9)]

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

for a in A:
    color = a // 400 if a < 3600 else 8
    colors[color] += 1

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

if min_color > 0:
    print("{} {}".format(min_color, min_color + colors[8]))
else:
    print("{} {}".format(1, colors[8]))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
kind = 0
cnt = 0
used = [False]*8
for a in A:
    tmp = a//400
    if tmp < 8 and not used[tmp]:
        kind += 1
        used[tmp] = True
    elif tmp >= 8:
        cnt += 1
print(kind if kind > 0 else 1, kind+cnt)

Submission status: Accepted

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

for k in range(8):
    if len([i for i in a if 400*k <= i < 400*(k + 1)]) > 0:
        count += 1

r =  len([i for i in a if 3200 <= i])
print('{} {}'.format(max(1, count), count + r))

Submission status: Accepted

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

Ans = 0
Cnt = [0]*9
for i in range(N):
    if A[i]>3200:
        A[i] = 3200
    Cnt[A[i]//400] += 1

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

# 最低1色は必要
# 自由色が選択可能なのは8色だけではない
print(max(1,Ans), Ans+Cnt[8])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

A = [int(x) for x in input().split()]

s = set()
god = 0
for a in A:
    if a >= 3200:
        god += 1
    else:
        s.add(a // 400)

print("{} {}".format(max(len(s), 1), len(s) + god))

Submission status: Accepted

Solution code:
n = int(input())
ratings = list(map(int, input().split(" ")))
colors = [400*i for i in range(1, 9)]
flags = [False for i in range(8)]
over3200 = 0
for rate in ratings:
    for i, border in enumerate(colors):
        if rate < border:
            flags[i] = True
            break
        elif i == 7:
            over3200 += 1
minAns = 0
for f in flags:
    if f:
        minAns += 1

maxAns = minAns + over3200
if minAns == 0 and over3200 > 0:
    minAns = 1
print(minAns, maxAns)

Submission status: Accepted

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

N = int(input())
nums = list(map(int, input().split()))
colors = [0]*9
mi = 0
ma = 0

for i in range(N):
    a = nums[i]
    if a < 400:
        colors[0] += 1
    elif a < 800:
        colors[1] += 1
    elif a < 1200:
        colors[2] += 1
    elif a < 1600:
        colors[3] += 1
    elif a < 2000:
        colors[4] += 1
    elif a < 2400:
        colors[5] += 1
    elif a < 2800:
        colors[6] += 1
    elif a < 3200:
        colors[7] += 1
    else:
        colors[8] += 1

for j in range(8):
    if colors[j] > 0:
        mi += 1
ma = mi
ma += colors[8]
if mi == 0:
    mi = 1

print(mi, ma)

Submission status: Accepted

Solution code:
import bisect
n = int(input())
a = sorted(list(int(i) for i in input().split()))
minct= 0
ov32 = n-bisect.bisect_left(a,3200)
#400で割る
def calc(n):
    return (n //400)
a2 = list(map(calc, a))
for i in range(8):
 if i in a2:
  minct +=1
minans = 0 

if minct == 0 and ov32>=1:
 minans =1
else:
 minans = minct
if minct+ov32>= 8:
 maxans = minct+ov32
else:
 maxans = minct+ov32
print(*[minans,maxans])