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:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())

    vec = [0] * 8
    over_red = 0
    for a in A:
        if a >= 3200:
            over_red += 1
        else:
            vec[a // 400] += 1

    c = 0
    for v in vec:
        if v > 0:
            c += 1
    if c > 0:
        print(c, c + over_red)
    else:
        print(1, over_red)

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

i=0
f1=f2=f3=f4=f5=f6=f7=f8=f9=0

while i<n:

    if 1<=a[i]<=399:

        f1=1

    elif 400<=a[i]<=799:

        f2=1

    elif 800<=a[i]<=1199:

        f3=1

    elif 1200<=a[i]<=1599:

        f4=1

    elif 1600<=a[i]<=1999:

        f5=1

    elif 2000<=a[i]<=2399:

        f6=1

    elif 2400<=a[i]<=2799:

        f7=1

    elif 2800<=a[i]<=3199:

        f8=1

    elif 3200<=a[i]:

        f9+=1

    i+=1

if f1==f2==f3==f4==f5==f6==f7==f8==0 and f9!=0:
    ans1=1
else:
    ans1 = f1+f2+f3+f4+f5+f6+f7+f8

ans2 = f1+f2+f3+f4+f5+f6+f7+f8+f9

print(str(ans1)+' '+str(ans2))

Submission status: Accepted

Solution code:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
r=Counter([min(x//400,8) for x in a])
l=len(list(iter(r)))
if r[8]==0:
  print(l,l)
else:
  print(max(l-1,1),l-1+r[8])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
col = [0]*8
over_cnt = 0
cnt_min = 0
cnt_max = 0
for i in range(n):
	if a[i] < 3200:
		col[(a[i])//400] += 1
		#print(col)
	else:
		over_cnt += 1
for j in range(8):
	#print(j)
	if col[j] > 0:
		cnt_min += 1
if cnt_min == 0:
	cnt_min = 1
	cnt_max = over_cnt
else:
	cnt_max = cnt_min+over_cnt
print(cnt_min,cnt_max)

Submission status: Accepted

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

num_free = 0
num_color = [False] * 8
for rate in nums:
    if rate < 3200:
        num_color[rate // 400] = True
    else:
        num_free += 1

ans = sum(num_color)
print('{} {}'.format(max(ans, 1), ans + num_free))

Submission status: Accepted

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

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

rate = [400,800,1200,1600,2000,2400,2800,3200]
R = [False]*len(rate)
red_plus = 0

for a in A:
    if a >= rate[-1]:
        red_plus += 1
    else:
        for i,r in enumerate(rate):
            if a < r:
                R[i] = True
                break
    
if R.count(True) == 0:
    print(1, R.count(True)+red_plus)
else:
    print(R.count(True), R.count(True)+red_plus)

Submission status: Accepted

Solution code:
n = int(input())
s = list(map(int,input().split()))
 
maxans = 0
minans = 0
 
color = [0]*8
red = 0
 
for i in s:
    if i>=3200:
        red += 1
    else:
        color[i//400] = 1
        
x = sum(color)
 
if x == 0:
    print(1,red)
else:
    print(x,x+red)

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))
d = set()
over = 0
for i in l:
    if i <= 399:
        d.add("gray")
    elif i <= 799:
        d.add("brown")
    elif i <= 1199:
        d.add("green")
    elif i <= 1599:
        d.add("light blue")
    elif i <= 1999:
        d.add("blue")
    elif i <= 2399:
        d.add("yellow")
    elif i <= 2799:
        d.add("orange")
    elif i <= 3199:
        d.add("red")
    else:
        over += 1

min_color = len(d)
if len(d) == 0:
    min_color +=1
max_color = len(d) + over

print(min_color, max_color)

Submission status: Accepted

Solution code:
N = int(input())
rate = list(map(int,input().split()))
lst = [i*400 for i in range(9)]
lstc = [0]*9

for i in rate:
    for j in range(len(lst)-1):
        #print((400*j),400*(j+1))
        if (400*j) <= i < 400*(j+1):
            lstc[j] += 1
            break
        
    if i >= 3200:
        lstc[-1] += 1
            
#print(lstc)
n = 0
for i in lstc:
    if i > 0:
        n += 1
nx = n-1

if lstc[-1] == 0:
    print(n,n)
elif nx == 0:
    print(1,lstc[-1])
else:
    print(nx,nx+lstc[-1])

Submission status: Accepted

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

cnt = 0
color = [False] * 8
for v in a:
    if v >= 3200:
        cnt += 1
    else:
        color[v//400] = True

num = color.count(True)
print(max(num, 1), num + cnt)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
t = [0] * 8
p = 0

for i in range(n):
    if a[i] < 3200:
        t[a[i] // 400] = 1
    else:
        p += 1

x = t.count(1)
amax = p+x
if x == 0:
    amin = 1
else:
    amin = x
print(amin,amax)

Submission status: Accepted

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
list = {}
list[8] = 0

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

if len(list) == 1:
    min = 1
else:
    min = len(list) - 1

if list[8] > 0:
    max = len(list) + list[8] - 1
else:
    max = len(list) - 1

print(min,max)

Submission status: Accepted

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

color = []
color2 = []

def rate(a):
    if a < 400:
        if 1 not in color:
            color.append(1)
    elif 400<= a and a<800:
        if 2 not in color:
            color.append(2)
    elif 800<=a and a<1200:
        if 3 not in color:
            color.append(3)
    elif 1200<=a and a<1600:
        if 4 not in color:
            color.append(4)
    elif 1600<=a and a<2000:
        if 5 not in color:
            color.append(5)
    elif 2000 <=a and a<2400:
        if 6 not in color:
            color.append(6)
    elif 2400 <=a and a<2800:
        if 7 not in color:
            color.append(7)
    elif 2800<=a and a<3200:
        if 8 not in color:
            color.append(8)
    elif a>= 3200:
        color2.append(a)

for i in range(N):
    rate(a[i])

max = len(color) + len(color2)

if len(color) == 0:
    print(1,max)
else:
    print(len(color),max)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[0]*9
while a:
  kazu=a.pop(0)
  if 1<=kazu < 400:
    b[0]=1
  elif kazu < 800:
    b[1]=1
  elif kazu < 1200:
    b[2]=1
  elif kazu < 1600:
    b[3]=1
  elif kazu < 2000:
    b[4]=1
  elif kazu < 2400:
    b[5]=1
  elif kazu < 2800:
    b[6]=1
  elif kazu < 3200:
    b[7]=1
  elif kazu >=3200:
    b[8]+=1
coma=b[8]
comi=0
for i in b[:8]:
  if i > 0:
    comi+=1
if coma > 0 and comi ==0:
  comi =1
if comi+coma >= n:
  maxgo=n
else:
  maxgo=comi+coma
print(comi,maxgo)

Submission status: Accepted

Solution code:
n = int(input())
rate = list(map(int, input().split()))
colo = []

for i in rate:
    if 1 <= i < 400:
        if 1 in colo:
            continue
        else:
            colo.append(1)
    if 400 <= i < 800:
        if 2 in colo:
            continue
        else:
            colo.append(2)
    if 800 <= i < 1200:
        if 3 in colo:
            continue
        else:
            colo.append(3)
    if 1200 <= i < 1600:
        if 4 in colo:
            continue
        else:
            colo.append(4)
    if 1600 <= i < 2000:
        if 5 in colo:
            continue
        else:
            colo.append(5)
    if 2000 <= i < 2400:
        if 6 in colo:
            continue
        else:
            colo.append(6)
    if 2400 <= i < 2800:
        if 7 in colo:
            continue
        else:
            colo.append(7)
    if 2800 <= i < 3200:
        if 8 in colo:
            continue
        else:
            colo.append(8)
    if 3200 <= i:
        colo.append(-1)

if -1 not in colo:
    print("{} {}".format(len(colo), len(colo)))
else:
    cnt = 0
    cnt_upto3200 = 0
    for i in range(1, 9):
        if i in colo:
            cnt += 1
    for j in colo:
        if j == -1:
            cnt_upto3200 += 1
    if cnt == 0:
        print("{} {}".format(1,  cnt_upto3200))
    else:
        print("{} {}".format(cnt, cnt + cnt_upto3200))

Submission status: Accepted

Solution code:
from collections import defaultdict
N = int(input())
al = list(map(int,input().split()))
cnt = 0
dic = defaultdict(int)
for i in al:
    if 1<= i <= 399:
        dic['gray'] += 1
    elif 400 <= i <= 799:
        dic['brown'] += 1
    elif 800 <= i <= 1199:
        dic['green'] += 1
    elif 1200 <= i <= 1599:
        dic['cyan'] += 1
    elif 1600 <= i <= 1999:
        dic['blue'] += 1
    elif 2000 <= i <= 2399:
        dic['yellow'] += 1
    elif 2400 <= i <= 2799:
        dic['orange'] += 1
    elif 2800 <= i <= 3199:
        dic['red'] += 1
    else:
        cnt += 1


ansmax = len(dic.keys()) + cnt
if ansmax > N:
    ansmax = N


ansmin = len(dic.keys())
if ansmin == 0 and cnt >= 1:
    ansmin = 1

print(ansmin,ansmax)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
b = [a[i]//400 for i in range(N) if a[i] < 3200]
c = len(set(b))
print(max(1,c), c+N-len(b))

Submission status: Accepted

Solution code:
N = int(input())
c = list(map(int,input().split()))
b = [0]*8
cnt = 0
for a in c:
    if 0<a<400:
        b[0]=1
    elif 399<a<800:
        b[1]=1
    elif 799<a<1200:
        b[2]=1
    elif 1199<a<1600:
        b[3]=1
    elif 1599<a<2000:
        b[4]=1
    elif 1999<a<2400:
        b[5]=1
    elif 2399<a<2800:
        b[6]=1
    elif 2799<a<3200:
        b[7]=1
    else:
        cnt += 1
print(max(1, b.count(1)), end = " ")
print(b.count(1) + cnt)

Submission status: Accepted

Solution code:
s = input()
n = int(s)

t_count = 0
f_count = 0
over = 0

colors = []
for i in range(8):
    colors.append(False)

v = input().split()

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

for i in range(len(colors)):
    if colors[i]:
        t_count += 1

if t_count == 0:
    min_ans = 1
else:
    min_ans = t_count
max_ans = t_count + over

print(min_ans, end=' ')
print(max_ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
lis=[0]*9
for num in a:
    lis[min(8,num//400)]+=1
kind=0
for i in range(8):
    if lis[i]>0:
        kind+=1
if kind==0:
    mini=1
else:
    mini=kind
maxi=kind+lis[8]
print(mini,maxi)
#print(lis)

Submission status: Accepted

Solution code:
# C - Colorful Leaderboard
N = int(input())
a = list(map(int, input().split()))

lst = [0,0,0,0,0,0,0,0,0]

for i in range(N):
	for j in range(1,9):
		if a[i] < 400*j:
			lst[j-1] = 1
			break
	else:
		lst[8] += 1

if sum(lst[0:8]) == 0:
    min = 1
else:
    min = sum(lst[0:8])
max = sum(lst)

print(min,max)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
C = [a//400 for a in A if a<3200]
D = len(set(C))
print(max(1,D),D+N-len(C))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
C = []
D = 0
ans = []

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

if D==0:
  ans = [len(set(C)),len(set(C))]
else:
  if len(C)==0:
    ans = [1,D]
  else:
    ans = [len(set(C)),len(set(C))+D]

print(*ans)

Submission status: Accepted

Solution code:
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n = int(input())
    a = list(map(int, input().split()))
    rate = [0]*8
    cnt = 0
    for x in a:
        r = x//400
        if r > 7:
            cnt += 1
        elif not rate[r]:
            rate[r] = 1
    s = sum(rate)
    mins = max(s,1)
    maxs = s+cnt
    print(mins, maxs)        
        
            



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n = int(input())
    a = list(map(int, input().split()))
    rate = [0]*8
    cnt = 0
    for x in a:
        r = x//400
        if r > 7:
            cnt += 1
        elif not rate[r]:
            rate[r] = 1
    s = sum(rate)
    mins = s
    if cnt > 0:
        mins += 1
        if s > 0:
            mins -=1
    maxs = s+cnt
    print(mins, maxs)        
        
            



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
la = [int(w) for w in input().split()]

cnt = [0]*9
for a in la:
    if a > 3200:
        a = 3200
    cnt[a // 400] += 1

mi = len([_ for _ in cnt[:8] if _ > 0])
ma = mi+cnt[8]

if mi == 0:
    mi = 1

print(mi, ma)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
input()
a = map(int, input().split())
c = [0] * 9
for i in a:
    c[min(8, i // 400)] += 1
s = sum(i > 0 for i in c[:8])
print(max(s, 1), s + c[8])

Submission status: Accepted

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

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


color=[0]*8
free=0

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

num = sum(color)

ans_1 = num
#全員レート3200
if ans_1==0:
    ans_1=1

ans_2 = num+free


print(ans_1,ans_2)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A = [a//400 for a in A]
l = len({0,1,2,3,4,5,6,7}&set(A))
S = sum(a>7 for a in A)
print(max(l, 1), l+S)

Submission status: Accepted

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

r_s=list(range(0,2801,400))
r_s[0]=1
r_s.append(3200)

r_e=list(range(399,3200,400))
r_e.append(4800)

def check_color(check):
    N=9
    for i in range(N):
        if r_s[i] <= check and r_e[i] >= check:
            return i
        
checklist=[]
checklist_8=[]
for a in A:
#     print( '======')
#     print(a)
    a=check_color(a)
#     print(a)
    if a != 8:
        checklist.append(a)
    else:
        checklist_8.append(a)

max_= len(set(checklist))+len(checklist_8)
min_= len(set(checklist))
        
max_ = max_
min_ = max(1,min_)

print(min_,max_)

Submission status: Accepted

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

Submission status: Accepted

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

Colors = []
High_scorer = []
for a in A:
    if a < 400:
        Colors.append("Gray")
    if 400 <= a and a < 800:
        Colors.append("Brown")
    if 800 <= a and a < 1200:
        Colors.append("Green")
    if 1200 <= a and a < 1600:
        Colors.append("Light_blue")
    if 1600 <= a and a < 2000:
        Colors.append("Blue")
    if 2000 <= a and a < 2400:
        Colors.append("Yellow")
    if 2400 <= a and a < 2800:
        Colors.append("Orange")
    if 2800 <= a and a < 3200:
        Colors.append("Red")
    if 3200 <= a:
        High_scorer.append(a)

MIN = len(set(Colors))
H = len(High_scorer)

if MIN >= 1:
    print(MIN, (MIN+H))
elif MIN == 0:
    print(1, H)

Submission status: Accepted

Solution code:
N, = list(map(int,input().split()))
a  = list(map(int,input().split()))
s = set()
c6=0
for ai in a:
    if ai>=3200:
        c6 += 1
    else:
        s |= set({ai//400})
print(max(1,len(s)),len(s)+c6)

Submission status: Accepted

Solution code:
n = int(input())
a_list = [int(x) for x in input().split()]
s = set()
o = 0
for a in a_list:
    r = a // 400
    if r >= 8:
        o += 1
    else:
        s.add(r)
c = len(s)
print(c if c > 0 else 1, c + o)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    As = list(map(int, input().split()))
    nums = []
    rainbow = 0
    for A in As:
        num = A // 400
        if num < 8:
            if num not in nums:
                nums.append(num)
        else:
            rainbow += 1
    ans_max = len(nums)+rainbow
    ans_min = max(1, len(nums))
    print(ans_min, ans_max)


if __name__ == "__main__":
    main()

Submission status: Accepted

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



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


def solve(n,a):
  flags = [False]*8
  numOfRainbow = 0
  for rate in a:
    color = rateToColor(rate)
    if color != 8:
      flags[color] = True
    else:
      numOfRainbow += 1
  if sum(flags):
    return sum(flags), sum(flags)+numOfRainbow
  else:
    return 1,numOfRainbow


def main():
  N = int(input())
  a = list(map(int,input().split()))
  print(*solve(N,a))
  return

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
check = [0] * 9
maxx = 0
minn = 0

for i in a:
    if 1 <= i <= 399:
        check[0] += 1
    elif 400 <= i <=799:
        check[1] += 1
    elif 800 <= i <= 1199:
        check[2] += 1
    elif 1200 <= i <= 1599:
        check[3] += 1
    elif 1600 <= i <= 1999:
        check[4] += 1
    elif 2000 <= i <= 2399:
        check[5] += 1
    elif 2400 <= i <= 2799:
        check[6] += 1
    elif 2800 <= i <= 3199:
        check[7] += 1
    elif i >= 3200:
        check[8] += 1

for i in range(9):
    if i <= 7 and check[i] >= 1:
        maxx += 1
        minn += 1
    if i == 8:
        maxx += check[8]
        if minn == 0 and check[8] >= 1:
            minn = 1

print(minn, maxx)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
colors = [0]*8
gold = 0
for a in map(int, input().split()):
    color = a//400
    if 8 <= color:
        gold += 1
        continue
    colors[color] = 1
print(max(sum(colors), 1), sum(colors)+gold)

Submission status: Accepted

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

X=[0]*8
Y=0

for a in A:
    if a>=3200:
        Y+=1
    else:
        X[a//400]+=1

a=max(1,8-X.count(0))
b=8-X.count(0)+Y
print(a,b)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
S = set()
_S = 0
for a in A:
    if a <= 399:
        S.add(0)
    elif 400 <= a <= 799:
        S.add(1)
    elif 800 <= a <= 1199:
        S.add(2)
    elif 1200 <= a <= 1599:
        S.add(3)
    elif 1600 <= a <= 1999:
        S.add(4)
    elif 2000 <= a <= 2399:
        S.add(5)
    elif 2400 <= a <= 2799:
        S.add(6)
    elif 2800 <= a <= 3199:
        S.add(7)
    else:
        _S += 1
print(max(1, len(S)), len(S) + _S)

Submission status: Accepted

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

for i in range(N):
  aa = int(A[i] / 400)
  if aa > 8:
    aa = 8
  ans[aa] += 1
  
min_a = 0
max_a = 0
for i in range(9):
  if i != 8:
    if ans[i] != 0:
      min_a += 1
      max_a += 1
  else:
    max_a += ans[i]
    
min_a = max(min_a, 1)    
print(min_a, max_a)

Submission status: Accepted

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

color = [False]*8
flex = 0
cnt = 0
for i in range(n):
    if a[i] < 400:
        color[0] = True
    elif a[i] < 800:
        color[1] = True
    elif a[i] < 1200:
        color[2] = True
    elif a[i] < 1600:
        color[3] = True
    elif a[i] < 2000:
        color[4] = True
    elif a[i] < 2400:
        color[5] = True
    elif a[i] < 2800:
        color[6] = True
    elif a[i] < 3200:
        color[7] = True
    else:
        flex += 1

for i in range(8):
    if color[i]:
        cnt += 1
mi = cnt
if mi == 0:
    mi = 1
cnt += flex

print(str(mi) + " " + str(cnt))

Submission status: Accepted

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

col = [0] * 8
opt = 0

for i in range(n):
    if 1 <= a[i] < 400:
        col[0] = 1
    elif 400 <= a[i] < 800:
        col[1] = 1
    elif 800 <= a[i] < 1200:
        col[2] = 1
    elif 1200 <= a[i] < 1600:
        col[3] = 1
    elif 1600 <= a[i] < 2000:
        col[4] = 1
    elif 2000 <= a[i] < 2400:
        col[5] = 1
    elif 2400 <= a[i] < 2800:
        col[6] = 1
    elif 2800 <= a[i] < 3200:
        col[7] = 1
    elif 3200 <= a[i]:
        opt += 1
if sum(col) == 0:
    print(1, opt)
else:
    print(sum(col), sum(col)+opt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
rates = list(map(int, input().split()))
colors = [0, 0, 0, 0, 0, 0, 0, 0]
n_overrate = 0
n_colors = 0

for rate in rates:
    if 1 <= rate <= 399:
        colors[0] = 1
    elif 400 <= rate <= 799:
        colors[1] = 1
    elif 800 <= rate <= 1199:
        colors[2] = 1
    elif 1200 <= rate <= 1599:
        colors[3] = 1
    elif 1600 <= rate <= 1999:
        colors[4] = 1
    elif 2000 <= rate <= 2399:
        colors[5] = 1
    elif 2400 <= rate <= 2799:
        colors[6] = 1
    elif 2800 <= rate <= 3199:
        colors[7] = 1
    else:
        n_overrate += 1

sum_color = sum(colors)
if sum_color == 0:
    n_min_colors = 1
    n_max_colors = n_overrate
else:
    n_min_colors = sum_color
    n_max_colors = n_min_colors + n_overrate
print('{} {}'.format(n_min_colors, n_max_colors))

Submission status: Accepted

Solution code:
def color_judge(n):
    if 1<=n<=399:
        return 'gray'
    elif n<=799:
        return 'brown'
    elif n<=1199:
        return 'green'
    elif n<=1599:
        return 'light blue'
    elif n<=1999:
        return 'blue'
    elif n<=2399:
        return 'yellow'
    elif n<=2799:
        return 'orange'
    elif n<=3199:
        return 'red'
    else:
        return 'choice'

n = int(input())
a = list(map(int, input().split()))
dic = {}
for i in a:
    if dic.get(color_judge(i)):
        dic[color_judge(i)] += 1
    else:
        dic[color_judge(i)] = 1
choice = 0
l = len(dic)
if dic.get('choice'):
    choice = dic['choice']
    l -= 1
print(max(1, l), l+choice)

Submission status: Accepted

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

N = int(input())
a = list(map(int,input().split()))
count = [0]*9
for ai in a:
    if 1 <= ai < 400:
        count[0] = 1
    elif 400 <= ai < 800:
        count[1] = 1
    elif 800 <= ai < 1200:
        count[2] = 1
    elif 1200 <= ai < 1600:
        count[3] = 1
    elif 1600 <= ai < 2000:
        count[4] = 1
    elif 2000 <= ai < 2400:
        count[5] = 1
    elif 2400 <= ai < 2800:
        count[6] = 1
    elif 2800 <= ai < 3200:
        count[7] = 1
    else:
        count[8] += 1
print(max(1,sum(count[:-1])),sum(count))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]


def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    w = set()
    c = 0
    for e in a:
        if 1 <= e <= 399:
            w.add(1)
        elif 400 <= e <= 799:
            w.add(2)
        elif 800 <= e <= 1199:
            w.add(3)
        elif 1200 <= e <= 1599:
            w.add(4)
        elif 1600 <= e <= 1999:
            w.add(5)
        elif 2000 <= e <= 2399:
            w.add(6)
        elif 2400 <= e <= 2799:
            w.add(7)
        elif 2800 <= e <= 3199:
            w.add(8)
        elif 3200 <= e:
            c += 1
    print(max(1, len(w)), len(w) + c)


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()

"""

"""

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    N = ii()
    a = list(mi())
    d = [0]*9
    for i in range(N):
        if a[i] < 400:
            d[0] = 1
        elif a[i] < 800:
            d[1] = 1
        elif a[i] < 1200:
            d[2] = 1
        elif a[i] < 1600:
            d[3] = 1
        elif a[i] < 2000:
            d[4] = 1
        elif a[i] < 2400:
            d[5] = 1
        elif a[i] < 2800:
            d[6] = 1
        elif a[i] < 3200:
            d[7] = 1
        else:
            d[8] += 1

    print(max(1, sum(d[:-1])), sum(d))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

col_list = [399,799,1199,1599,1999,2399,2799,3199]
count_list = [0]*(len(col_list)+1)

for i in range(N):
    for j in range(len(col_list)+1):
        if j == len(col_list):
            if 3200<=S[i]:
                count_list[j] = count_list[j] + 1
        elif S[i]<=col_list[j]:
            count_list[j] = count_list[j]+1
            break

ans = 0
for i in range(len(col_list)):

    if count_list[i] != 0:
        ans += 1
print(str(max(ans,1)) + ' ' + str(ans+count_list[-1]))

Submission status: Accepted

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

flag = [0]*9
t = 0
x = 0
y = 400
while y <= 3200:
  for i in a:
    if x <= i < y: flag[t] = 1
  t += 1
  x += 400
  y += 400
else:
  for i in a:
    if 3200 <= i: flag[8] += 1

if sum(flag[:8]) == 0:
  print(1,flag[8])
  exit()
      
total = sum(flag)
print(total - flag[8], total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
lst=list(map(int,input().split()))
sp=[]
br=[]
gr=[]
cy=[]
bl=[]
yl=[]
og=[]
rd=[]
colorful=[]

for i in lst:
    if 0<=i<400:
        sp.append(i)
    elif 400<=i<800:
        br.append(i)
    elif 800<=i<1200:
        gr.append(i)
    elif 1200<=i<1600:
        cy.append(i)
    elif 1600<=i<2000:
        bl.append(i)
    elif 2000<=i<2400:
        yl.append(i)
    elif 2400<=i<2800:
        og.append(i)
    elif 2800<=i<3200:
        rd.append(i)
    else:
        colorful.append(i)

if len(colorful)==n:
    print(1,n)
else:
    mi=0
    mx=0
    if len(sp)>0:
        mi+=1
        mx+=1
    if len(br)>0:
        mi+=1
        mx+=1
    if len(gr)>0:
        mi+=1
        mx+=1
    if len(cy)>0:
        mi+=1
        mx+=1
    if len(bl)>0:
        mi+=1
        mx+=1
    if len(yl)>0:
        mi+=1
        mx+=1
    if len(og)>0:
        mi+=1
        mx+=1
    if len(rd)>0:
        mi+=1
        mx+=1
    mx+=len(colorful)
    
    print(mi,mx)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split()))
col=[0]*9
for i in range(n):
    j=min(8, a[i]//400)
    col[j]+=1
zero=0
cnt=0
for c in range(len(col)-1):
    if col[c]==0:
        zero+=1
    else:
        cnt+=1
m=max(cnt,1)
M=cnt+col[-1]
print(m,M)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
color = [False]*8
over_human = 0
for i in a:
    if(i<=399):
        color[0]=True
    elif(i<=799):
        color[1]=True
    elif(i<=1199):
        color[2]=True
    elif(i<=1599):
        color[3]=True
    elif(i<=1999):
        color[4]=True
    elif(i<=2399):
        color[5]=True
    elif(i<=2799):
        color[6]=True
    elif(i<=3199):
        color[7]=True
    elif(i>=3200):
        over_human += 1
if(color.count(True)==0):
    print(1,color.count(True)+over_human)
else:
    print(color.count(True),color.count(True)+over_human)