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: Wrong Answer

Solution code:
def main():
    N = int(input())
    a = list(map(int,input().split()))
    col_list = [0]*8
    free = 0
    for i in range(N):
        if a[i] < 3200:
            col = a[i]//400
            col_list[col] += 1
        else:
            free += 1
    non_col = col_list.count(0)
    print(8-non_col,min(8-non_col+free,8))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
As = list(map(int, input().split()))
s = set()
ne = 0
for A in As:
  t = A//400
  if t >= 8:
    ne += 1
  else:
    s.add(t)
if len(s) == 0 and ne > 0:
  tmin = 1
else:
  tmin = len(s)
tmax = min(8, len(s)+ne)
print(tmin, tmax)

Submission status: Wrong Answer

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

d = defaultdict(int)
for i in range(n):
    for border in reversed(range(0, 3201, 400)):
        if a[i] >= border:
            d[border] += 1
            break

ans_min = ans_max = 0
if 3200 in d:
    ans_min, ans_max = len(d)-1, len(d)-1+d[3200]
else:
    ans_min, ans_max = len(d), len(d)

print(ans_min, ans_max)

Submission status: Wrong Answer

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

maxs = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
nums = [0 for _ in range(len(maxs))]

count = 0
for a_i in a:
    found = False
    for i in range(len(maxs)):
        if a_i < maxs[i]:
            nums[i] += 1
            found = True
            break
    if not found:
        count += 1

min_num = len(nums) - nums.count(0)
max_num = min(min_num + count, len(maxs))
if 0 == min_num:
    min_num = 1
print("{} {}".format(min_num, max_num))

Submission status: Wrong Answer

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

maxs = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
nums = [0 for _ in range(len(maxs))]

count = 0
for a_i in a:
    found = False
    for i in range(len(maxs)):
        if a_i < maxs[i]:
            nums[i] += 1
            found = True
            break
    if not found:
        count += 1

zero_count = nums.count(0)
min_num = len(nums) - zero_count
max_num = min_num + min(zero_count, count)
if 0 == min_num:
    min_num = 1
print("{} {}".format(min_num, max_num))

Submission status: Wrong Answer

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

maxs = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
nums = [0 for _ in range(len(maxs))]

count = 0
for a_i in a:
    found = False
    for i in range(len(maxs)):
        if a_i < maxs[i]:
            nums[i] += 1
            found = True
            break
    if not found:
        count += 1

zero_count = nums.count(0)
min_num = len(nums) - zero_count
max_num = min_num + min(zero_count, count)
print("{} {}".format(min_num, max_num))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
	a[i]//=400
free=0
b=set()
for i in range(n):
	if a[i]>=8:
		free+=1
	else:
		b.add(a[i])
cnt=len(b)
x=max(cnt,1)
y=min(cnt+free,n,8)
print(x,y)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
	a[i]//=400
free=0
b=set()
for i in range(n):
	if a[i]>=8:
		free+=1
	else:
		b.add(a[i])
cnt=len(b)
x=max(cnt,1)
y=min(cnt+free,n,9)
print(x,y)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
	a[i]//=400
free=0
b=set()
for i in range(n):
	if a[i]>=8:
		free+=1
	else:
		b.add(a[i])
cnt=len(b)
x=max(cnt,1)
y=min(cnt+free,9)
print(x,y)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
	if a[i]==0:
		a[i]=-1
	else:
		a[i]//=400
a.sort()
free=0
b=[]
cnt=0
for i in range(n):
	if a[i]<=7:
		b.append(a[i])
	else:
		free+=1
b=set(b)
for i in range(-1,8):
	if i in b:
		cnt+=1
x=max(cnt,1)
y=min(cnt+free,9)
print(x,y)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
	a[i]//=400
a.sort()
free=0
b=[]
cnt=0
for i in range(n):
	if a[i]<=7:
		b.append(a[i])
	else:
		free+=1
b=set(b)
for i in range(8):
	if i in b:
		cnt+=1
x=max(cnt,1)
y=min(cnt+free,8)
print(x,y)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
	a[i]//=400
a.sort()
free=0
b=[]
cnt=0
for i in range(n):
	if a[i]<=7:
		b.append(a[i])
	else:
		free+=1
for i in range(8):
	if i in b:
		cnt+=1
x=cnt
y=min(cnt+free,8)
print(x,y)

Submission status: Wrong Answer

Solution code:
import bisect
color = range(400,3201,400)
num_color = len(color)
p = [0]*(num_color+1)
N=int(input())
for a in input().split():
    a=int(a)
    p[bisect.bisect_right(color, a)]+=1
print(max(1, num_color-p[:-1].count(0)), min(num_color, num_color-p[:-1].count(0)+p[-1]))

Submission status: Wrong Answer

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

if __name__ == '__main__':
    N = int(input())
    a = list(map(int, input().split()))

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

    num = len(A)
    min = num
    if min == 0 and over >= 1:
        min = 1

    if over >= 1:
        num += over
        if num >= 8:
            num = 8

    print(min, num)

Submission status: Wrong Answer

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

if __name__ == '__main__':
    N = int(input())
    a = list(map(int, input().split()))

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

    num = len(A)
    min = num
    if min == 0:
        min = 1

    if over >= 1:
        num += over
        if num >= 8:
            num = 8

    print(min, num)

Submission status: Wrong Answer

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

if __name__ == '__main__':
    N = int(input())
    a = list(map(int, input().split()))

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

    num = len(A)
    min = num
    if min == 0:
        min = 1


    if over > 1:
        num += over
        if num >= 8:
            num = 8

    print(min, num)

Submission status: Wrong Answer

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

if __name__ == '__main__':
    N = int(input())
    a = list(map(int, input().split()))

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

    num = len(A)
    min = num


    if over > 1:
        num += over
        if num >= 8:
            num = 8

    print(min, num)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
A = []
B = []
d = []
for i in a:
    add = i // 400
    if add < 8:
        A.append(add)
    else:
        B.append(add)
    if add not in d and add < 8:
        d.append(add)
ans_min = len(d)
if len(d) == 0 and len(B) > 0:
    ans_min = 1
if 8 - len(d) <= len(B):
    ans_max = 8
else:
    ans_max = len(d) + len(B)
print(ans_min)
print(ans_max)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
A = []
B = []
d = []
for i in a:
    add = i // 400
    if add < 8:
        A.append(add)
    else:
        B.append(add)
    if add not in d and add < 8:
        d.append(add)
ans_min = len(d)
if 8 - len(d) <= len(B):
    ans_max = 8
else:
    ans_max = ans_min + len(B)
print(ans_min)
print(ans_max)

Submission status: Wrong Answer

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

for i in range(n):
    if 1 <= a[i] < 400:
        min_l.add(1)
    elif 400 <= a[i] < 800:
        min_l.add(2)
    elif 800 <= a[i] < 1200:
        min_l.add(3)
    elif 1200 <= a[i] < 1600:
        min_l.add(4)
    elif 1600 <= a[i] < 2000:
        min_l.add(5)
    elif 2000 <= a[i] < 2400:
        min_l.add(6)
    elif 2400 <= a[i] < 2800:
        min_l.add(7)
    elif 2800 <= a[i] < 3200:
        min_l.add(8)
    else:
        max_l.add(i)

min_v = len(min_l)
# if len(min_l)+len(max_l) > 8:
#     max_v = 8
# else:
max_v = len(min_l)+len(max_l)
        
print(min_v,max_v)

Submission status: Wrong Answer

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

for i in range(n):
    if 1 <= a[i] < 400:
        min_l.add(1)
    elif 400 <= a[i] < 800:
        min_l.add(2)
    elif 800 <= a[i] < 1200:
        min_l.add(3)
    elif 1200 <= a[i] < 1600:
        min_l.add(4)
    elif 1600 <= a[i] < 2000:
        min_l.add(5)
    elif 2000 <= a[i] < 2400:
        min_l.add(6)
    elif 2400 <= a[i] < 2800:
        min_l.add(7)
    elif 2800 <= a[i] < 3200:
        min_l.add(8)
    else:
        max_l.add(i)

min_v = len(min_l)
if len(min_l)+len(max_l) > 8:
    max_v = 8
else:
    max_v = len(min_l)+len(max_l)
        
print(min_v,max_v)

Submission status: Wrong Answer

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

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

min_v = len(min_l)
if len(min_l)+len(max_l) > 8:
    max_v = 8
else:
    max_v = len(min_l)+len(max_l)
        
print(min_v,max_v)

Submission status: Wrong Answer

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

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

min_v = len(min_l)
if len(min_l)+len(max_l) > 7:
    max_v = 7
else:
    max_v = len(min_l)+len(max_l)
        
print(min_v,max_v)

Submission status: Wrong Answer

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

for i in range(n):
    if 1 <= a[i] <= 399:
        min_l.add(1)
    elif 400 <= a[i] <= 799:
        min_l.add(2)
    elif 800 <= a[i] <= 1199:
        min_l.add(3)
    elif 1200 <= a[i] <= 1999:
        min_l.add(4)
    elif 2000 <= a[i] <= 2399:
        min_l.add(5)
    elif 2400 <= a[i] <= 2799:
        min_l.add(6)
    elif 2800 <= a[i] <= 3199:
        min_l.add(7)
    else:
        max_l.add(i)

min_v = len(min_l)
if len(min_l)+len(max_l) > 7:
    max_v = 7
else:
    max_v = len(min_l)+len(max_l)
        
print(min_v,max_v)

Submission status: Wrong Answer

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

for i in range(n):
    if 1 <= a[i] <= 399:
        min_l.add(1)
    elif 400 <= a[i] <= 799:
        min_l.add(2)
    elif 800 <= a[i] <= 1199:
        min_l.add(3)
    elif 1200 <= a[i] <= 1999:
        min_l.add(4)
    elif 2000 <= a[i] <= 2399:
        min_l.add(5)
    elif 2400 <= a[i] <= 2799:
        min_l.add(6)
    elif 2800 <= a[i] <= 3199:
        min_l.add(7)
    else:
        max_l.add(i)
        
print(len(min_l),len(min_l)+len(max_l))

Submission status: Wrong Answer

Solution code:
def c0(li):
  ret=0
  for a in li:
    if not a==0:
      ret+=1
  return ret
n=int(input())
l=input().split()
colors=[0]*8
for i in l:
  if int(i)<400:
    colors[0]+=1
  elif int(i)<800:
    colors[1]+=1
  elif int(i)<1200:
    colors[2]+=1
  elif int(i)<1600:
    colors[3]+=1
  elif int(i)<2000:
    colors[4]+=1
  elif int(i)<2400:
    colors[5]+=1
  elif int(i)<2800:
    colors[6]+=1
  elif int(i)<3200:
    colors[7]+=1
maximum=min(c0(colors)+(n-sum(colors)),8)
minimum=0
if c0(colors)>0:
  minimum=c0(colors)
else:
  minimum=1
print(str(minimum)+' '+str(maximum))

Submission status: Wrong Answer

Solution code:
def c0(li):
  ret=0
  for a in li:
    if not a==0:
      ret+=1
  return ret
n=int(input())
l=input().split()
colors=[0]*8
for i in l:
  if int(i)<400:
    colors[0]+=1
  elif int(i)<800:
    colors[1]+=1
  elif int(i)<1200:
    colors[2]+=1
  elif int(i)<1600:
    colors[3]+=1
  elif int(i)<2000:
    colors[4]+=1
  elif int(i)<2400:
    colors[5]+=1
  elif int(i)<2800:
    colors[6]+=1
  elif int(i)<3200:
    colors[7]+=1
maximum=min(c0(colors)+(n-sum(colors)),8)
minimum=0
if sum(colors)>0:
  minimum=c0(colors)
else:
  minimum=1
print(str(minimum)+' '+str(maximum))

Submission status: Wrong Answer

Solution code:
def c0(li):
  ret=0
  for a in li:
    if not a==0:
      ret+=1
  return ret
n=int(input())
l=input().split()
colors=[0]*8
for i in l:
  if int(i)<400:
    colors[0]+=1
  elif int(i)<800:
    colors[1]+=1
  elif int(i)<1200:
    colors[2]+=1
  elif int(i)<1600:
    colors[3]+=1
  elif int(i)<2000:
    colors[4]+=1
  elif int(i)<2400:
    colors[5]+=1
  elif int(i)<2800:
    colors[6]+=1
  elif int(i)<3200:
    colors[7]+=1
geek=n-sum(colors)
minimum=c0(colors)
maximum=0
if geek==0:
  maximum=c0(colors)
else:
  if geek<=colors.count(0):
    maximum=c0(colors)+geek
  else:
    maximum=8
print(str(minimum)+' '+str(maximum))

Submission status: Wrong Answer

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

for j in range(8):
    if li[j]!=0:
        kind += 1

if kind==0:
    print(1,min(kind+overrate,8))
else:
    print(min(8,kind),min(kind+overrate,8))

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
li = [""]*N
overrate = 0
for i in range(N):
    if a[i]>=3200:
        overrate += 1
        continue
    else:
        li[i] = a[i]//400
kind = len(list(set(li)))-min(li.count(""),1)
mn = max(1,kind)
mx = min(8,kind+overrate)
print(mn,mx)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
li = [10**9]*N
overrate = 0
for i in range(N):
    if a[i]>=3200:
        overrate += 1
        continue
    else:
        li[i] = a[i]//400
kind = len(list(set(li)))
mn = min(kind-min(overrate,1),8)
mx = min(8,max(kind-min(overrate,1)+overrate,1))
print(mn,mx)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
li = [10**9]*N
overrate = 0
for i in range(N):
    if a[i]>=3200:
        overrate += 1
        continue
    else:
        li[i] = a[i]//400
kind = len(list(set(li)))
mn = min(kind-min(overrate,1),8)
mx = min(8,max(kind-min(overrate,1)+overrate,1))
print(mn,mx)
print(li,kind,overrate)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
li = [10**9]*N
overrate = 0
for i in range(N):
    if a[i]>=3200:
        overrate += 1
        continue
    else:
        li[i] = a[i]//400
kind = len(list(set(li)))
mn = min(kind-min(overrate,1),8)
mx = min(8,max(kind-1+overrate,1))
print(mn,mx)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
color = [0 for _ in range(8)]
e = 0

for a in A:
    if a >= 3200:
        e += 1
        continue
    for i in range(8):
        if a >= i * 400 and a < (i + 1) * 400:
            color[i] += 1

res = len([0 for c in color if c > 0])
if e == 0:
    print(res, res)
else:
    print(res, res + e)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
color = [0 for _ in range(8)]
e = 0

for a in A:
    if a >= 3200:
        e += 1
        continue
    for i in range(8):
        if a >= i * 400 and a < (i + 1) * 400:
            color[i] += 1

res = len([0 for c in color if c > 0])
if e == 0:
    print(res, res)
else:
    print(res, min(8, res + e))

Submission status: Wrong Answer

Solution code:

import bisect
import collections
import itertools


def getint(): return int(input())
def getints(): return list(map(int, input().split()))
def getint2d(rows): return [getints() for _ in range(rows)]
def getgrid(rows): return [input() for _ in range(rows)]
def array1d(n, value): return [value for _ in range(n)]
def array2d(n, m, value): return [array1d(m, value) for _ in range(n)]

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

n = getint()
xs = getints()

st = set()

any_color=0

for x in xs:
    t = -1
    for i in range(len(types)):
        if x < types[i]:
            t = i
            break
    if t >= 0:
        st.add(t)
    else:
        any_color += 1

res_min = max(len(st), 1)
res_max = min(len(st) + any_color, 8)
print(res_min, res_max)

Submission status: Wrong Answer

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

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

tmp = 0
for i in range(len(check)-1):
    if check[i] >= 1:
        tmp += 1

ans_min = tmp
ans_max = tmp + check[-1]

ans = str(ans_min) + ' ' + str(ans_max)
print(ans)

Submission status: Wrong Answer

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

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

tmp = 0
for i in range(len(check)-1):
    if check[i] >= 1:
        tmp += 1

ans_min = tmp
ans_max = min(tmp + check[-1], 8)

ans = str(ans_min) + ' ' + str(ans_max)
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from collections import Counter
INF = float("inf")


def solve(N: int, a: "List[int]"):
    c = Counter()
    for aa in a:
        c[min(aa//400, 8)] += 1

    tot = 0
    for k in c:
        if k == 8:
            continue
        else:
            tot += 1
    if tot == 0 and c[8] > 0:
        tot = 1
    print(tot, tot+c[8])

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from collections import Counter
INF = float("inf")


def solve(N: int, a: "List[int]"):
    c = Counter()
    for aa in a:
        c[min(aa//400, 8)] += 1

    tot = 0
    rainbow = 0
    for k in c:
        if k == 8 and c[k] > 0:
            rainbow += c[k]
        else:
            tot += 1
    print(tot, tot+rainbow)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

colorCount = defaultdict(int)

for a in A:
    if a < 400:
        colorCount['a'] += 1
    elif a < 800:
        colorCount['b'] += 1
    elif a < 1200:
        colorCount['c'] += 1
    elif a < 1600:
        colorCount['d'] += 1
    elif a < 2000:
        colorCount['e'] += 1
    elif a < 2400:
        colorCount['f'] += 1
    elif a < 2800:
        colorCount['g'] += 1
    elif a < 3200:
        colorCount['h'] += 1
    else:
        colorCount['z'] += 1

minAns = len(colorCount)
maxAns = minAns
if colorCount['z'] > 0:
    if minAns == 1:
        minAns = 1
        maxAns = min(8, colorCount['z'])
    else:
        minAns -= 1
        maxAns = min(8, maxAns - 1 + colorCount['z'])

print(minAns, maxAns)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

colorCount = defaultdict(int)

for a in A:
    if a < 400:
        colorCount['a'] += 1
    elif a < 800:
        colorCount['b'] += 1
    elif a < 1200:
        colorCount['c'] += 1
    elif a < 1600:
        colorCount['d'] += 1
    elif a < 2000:
        colorCount['e'] += 1
    elif a < 2400:
        colorCount['f'] += 1
    elif a < 2800:
        colorCount['g'] += 1
    elif a < 3200:
        colorCount['h'] += 1
    else:
        colorCount['z'] += 1

minAns = len(colorCount)
maxAns = minAns
if colorCount['z'] > 0:
    if minAns > 1:
        minAns -= 1
        maxAns = min(8, len(colorCount) - 1 + colorCount['z'])
    else:
        maxAns = min(8, colorCount['z'])

print(minAns, maxAns)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

colorCount = defaultdict(int)

for a in A:
    if a < 400:
        colorCount['a'] += 1
    elif a < 800:
        colorCount['b'] += 1
    elif a < 1200:
        colorCount['c'] += 1
    elif a < 1600:
        colorCount['d'] += 1
    elif a < 2000:
        colorCount['e'] += 1
    elif a < 2400:
        colorCount['f'] += 1
    elif a < 2800:
        colorCount['g'] += 1
    elif a < 3200:
        colorCount['h'] += 1
    else:
        colorCount['z'] += 1

minAns = len(colorCount)
maxAns = minAns
if colorCount['z'] > 0:
    if minAns > 1:
        minAns -= 1
        maxAns = min(8, len(colorCount) - 1 + colorCount['z'])
    else:
        maxAns = colorCount['z']

print(minAns, maxAns)

Submission status: Wrong Answer

Solution code:
N=input()
a=list(map(int,input().split()))
j=range(400,3600,400)
c=[0]*8
r=0
for i in a:
    for k in range(8):
        if i>=3200:
            r+=1
            break
        if i<j[k]:
            c[k]+=1
            break
ans=8-c.count(0)
print(ans,ans+r)

Submission status: Wrong Answer

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

rates = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
l = [0] * 8
tmp = 0
for i in range(N):
    for j in range(8):
        if a[i] < rates[j]:
            l[j] = 1
            break
    else:
        tmp += 1

print(max(sum(l), 1), min(sum(l)+tmp, 9))

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc064/tasks/abc064_c

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

rates = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
l = [0] * 8
tmp = 0
for i in range(N):
    for j in range(8):
        if a[i] < rates[j]:
            l[j] = 1
            break
    if a[i] >= 3200:
        tmp += 1

print(max(sum(l), 1), min(sum(l)+tmp, 8))

Submission status: Wrong Answer

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

rates = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
l = [0] * 8
tmp = 0
for i in range(N):
    for j in range(8):
        if a[i] < rates[j]:
            l[j] = 1
            break
    else:
        tmp += 1

print(max(sum(l), 1), min(sum(l)+tmp, 8))

Submission status: Wrong Answer

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

rates = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
l = [0] * 8
tmp = 0
for i in range(N):
    for j in range(8):
        if a[i] < rates[j]:
            l[j] = 1
            break
    else:
        tmp += 1

print(sum(l), min(sum(l)+tmp, 8))

Submission status: Wrong Answer

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

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

color = [0] * 8
over = 0
for i in range(N) :
    if a[i] >= 3200 :
        over += 1
    else :
        color[a[i]//400] += 1

m = 8 - color.count(0)
print(m, m + over)

Submission status: Wrong Answer

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

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

color = [0] * 8
over = 0
for i in range(N) :
    if a[i] >= 3200 :
        over += 1
    else :
        color[a[i]//400] += 1

m = 8 - color.count(0)
print(m, min(8, m + over))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
color = [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 and 400*(j-1) <= a[i] and color[j-1] == 0:
            color[j-1] += 1
    if a[i] >= 3200:
        color[8] += 1
print(sum(color[0:8]),sum(color))

Submission status: Wrong Answer

Solution code:


def f(v):
    idx = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 9999]
    for i, maxval in enumerate(idx):
        if v <= maxval: return i


def solve():
    N = int(input())
    colors = [0] * 9

    for i in [int(v) for v in input().split()]:
        colors[f(i)] += 1

    _cnt = len([c for c in colors[:-1] if c > 0])

    max_cnt = _cnt + min(8 - _cnt, colors[-1])
    min_cnt = 1 if _cnt == 0 else _cnt
    print(min_cnt, max_cnt)

solve()

Submission status: Wrong Answer

Solution code:
N = int(input())


def f(v):
    idx = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 9999]
    for i, maxval in enumerate(idx):
        if v <= maxval: return i


colors = [0] * 9

for i in [int(v) for v in input().split()]:
    colors[f(i)] += 1

_cnt = len([c for c in colors[:-1] if c > 0])

max_cnt = _cnt + min(8 - _cnt, colors[-1])
min_cnt = 1 if _cnt == 0 else _cnt
print(min_cnt, max_cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())


def f(v):
    idx = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 9999]
    for i, maxval in enumerate(idx):
        if v <= maxval: return i


colors = [0] * 9

for i in [int(v) for v in input().split()]:
    colors[f(i)] += 1

_cnt = len([c for c in colors[:-1] if c > 0])
if _cnt == 0:
    min_cnt = 1
    max_cnt = 1
else:
    min_cnt = _cnt
    max_cnt = min_cnt + min(8 - _cnt, colors[-1])
print(min_cnt, max_cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
rt = list(map(int,input().split()))
clr = [0 for _ in range(9)]
for i in range(n):
  now = rt[i] // 400
  try:
    clr[now] += 1
  except:
    clr[8] += 1
ans = 0
top = clr[8]
for j in range(8):
  if clr[j] != 0:
    ans += 1
if top == 0:
  print(str(ans) + ' ' + str(ans))
else:
  print(str(max(ans,1)) + ' ' + str(min(8,ans+top)))
#print(clr)

Submission status: Wrong Answer

Solution code:
n = int(input())
rt = list(map(int,input().split()))
clr = [0 for _ in range(9)]
for i in range(n):
  now = rt[i]
  for j in range(8):
    if now < 400 * (j+1):
      clr[j] += 1
      break
  else:
    clr[8] += 1
ans = 0
top = clr[8]
for j in range(8):
  if clr[j] != 0:
    ans += 1
if top == 0:
  print(str(ans) + ' ' + str(ans))
else:
  print(str(max(ans,1)) + ' ' + str(min(8,ans+top)))
#print(clr)

Submission status: Wrong Answer

Solution code:
n = int(input())
rt = list(map(int,input().split()))
clr = [0 for _ in range(9)]
for i in range(n):
  now = rt[i]
  for j in range(8):
    if now < 400 * (j+1):
      clr[j] += 1
      break
  else:
    clr[8] += 1
ans = 0
top = clr[8]
for j in range(8):
  if clr[j] != 0:
    ans += 1
if top == 0:
  print(str(ans) + ' ' + str(ans))
else:
  print(str(max(ans,1)) + ' ' + str(min(8,ans+top)))
print(clr)

Submission status: Wrong Answer

Solution code:
n = int(input())
rt = list(map(int,input().split()))
clr = [0 for _ in range(9)]
for i in range(n):
  now = rt[i]
  for j in range(9):
    if now < 400 * (j+1):
      clr[j] += 1
      break
ans = 0
top = clr[8]
for j in range(8):
  if clr[j] != 0:
    ans += 1
if top == 0:
  print(str(ans) + ' ' + str(ans))
else:
  print(str(max(ans,1)) + ' ' + str(min(8,ans+top)))
#print(clr)

Submission status: Wrong Answer

Solution code:
rates  = [399,799,1199,1599,1999,2399,2799,3199]
from collections import defaultdict


def return_index(score):
  for i in rates:
    if score <= i:
      return rates.index(i)
  else:
    return 8

N = int(input())
A = list(map(int,input().split()))
d = defaultdict(int)
for a in A:
  d[return_index(a)] += 1
key_len = len(d.keys())
num_of_9s = d[8]
has_9 = 1 if num_of_9s > 0 else 0
print("{} {}".format(key_len-has_9 ,key_len-has_9+num_of_9s ))

Submission status: Wrong Answer

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

l = []
over3200 = 0
for i in a:
    if i >= 3200:
        over3200 += 1
    else:
        l.append(i//400)
print(len(set(l)),len(set(l))+over3200)