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: Runtime Error

Solution code:
def main():
    n = int(input())
    a = list(map(int,input().split()))
    l = [0] * 8
    for v in a :
        l[v//400] += 1
    cnt = 0
    for v in range(len(l)-1):
        if v != 0: cnt+=1

    mx = cnt + l[-1]
    mn = cnt if cnt != 0 else 1 if l[-1] != 0 else 0
    print("{} {}".format(str(mn),str(mx)))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

hist = [0]*9
for i in A:
    hist[i//400] += 1

ansmin = 0
for i in hist[:-1]:
    if i > 0:
        ansmin += 1
print("{} {}".format(ansmin, ansmin+hist[-1]))

Submission status: Runtime Error

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

n = INT()
a = LIST()
arr = []
plus = 0
for i in range(n):
    flag = True
    for j in range(1, 9):
        if a[i] < j * 400:
            if not j in arr:
                arr.append(j)
            flag = False
            break
    if flag:
        plus += 1
debug(len(set(arr)), plus, arr)
ansmx = min(len(set(arr)) + plus, 8)
ansmn = max(1, len(set(arr)))
print(ansmn, ansmx)

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    cnt = [0]*9
    for a in A:
        cnt[a//400] += 1
    ans = sum(int(a > 0) for a in cnt[:-1])
    print(ans, ans+cnt[-1])


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ls = [False] * 8
    cnt = 0
    for i in A:

        if i<3200:
            ls[i//400]=True
        else:
            cnt += 1

    if ls.count(True)==0:
        if cnt==0:
            minval=0
        else:
            minval=1
    if ls.count(False) <= cnt:
        maxval = 8
    else:
        maxval = 8 - (ls.count(False) - cnt)

    print(minval, maxval)


resolve()

Submission status: Runtime Error

Solution code:
def main():
    import sys
    n = int(input())
    a = list(map(int, input().split()))
    color = [0] * 8
    sub_color = 0
    count = 0
    for score in a
        if score <= 0:
            continue
        for i in range(8):
            if i*400 < score <= 399+(i*400):
                color[i] += 1
        if score >= 3200:
            sub_color += 1
    for j in color:
        if j != 0:
            count += 1
    if count + sub_color >= 8:
        print(count, 8, sep=" ")
    else:
        print(count, count+sub_color, sep=" ")

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
def main():
    import sys
    n = int(input())
    a = list(map(int, input().split()))
    color = [0] * 8
    sub_color = 0
    count = 0
    for score in a
        if score <= 0:
            continue
        for i in range(8):
            if i*400 <= score <= 399+(i*400):
                color[i] += 1
        if score >= 3200:
            sub_color += 1
    for j in color:
        if j != 0:
            count += 1
    if count + sub_color >= 8:
        print(count, 8, sep=" ")
    else:
        print(count, count+sub_color, sep=" ")

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
from bisect import bisect_right
from collections import Counter

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

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

idx = []

for a in A:
    idx.append(bisect_right(rate, a))

# print(idx)

c = Counter(idx)

print(c)/

min_c = len(c.keys())
if (7 in c.keys()) and (8 in c.keys()):
    min_c -= 1
max_c = 0
for i in range(8):
    if i in c.keys():
        max_c += 1
if 8 in c.keys():
    # min_c -= 1
    # max_c += min(8, c[8])
    max_c += c[8]
    # if max_c > 8:
    #     max_c = 8

print(min_c, max_c)

Submission status: Runtime Error

Solution code:
def solve():
    _ = int(input())
    a = list(map(int, input().split()))
    
    counter = [0] * 9
    for ai in a:
        counter[ai // 400] += 1
    
    ans_min = 0
    for i in range(8):
        if 0 < counter[i]:
            ans_min += 1
    
    ans_max = min(8, ans_min + counter[-1])
    print(ans_min, ans_max)


if __name__ == '__main__':
    solve()

Submission status: Runtime Error

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

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

#bの中で、０ではない要素数をカウントする
low = 0
for i in b:
    if i >= 0:
        low += 1

if low == 0:
    mini = 1
else:
    mn = low
mx = c + over
print(mini,mx)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
w = [0 for i in range(9)]
count = 0
for i in a:
    if i < 3200 and w[i//400]==0:
        count+=1
    w[i//400]+=1
if count == 0:
    print(1,w[8])
elif w[8] == 0:
    print(count,count)
else:
    b= count+w[8]
    print(count,b)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
w = [0 for i in range(9)]
count = 0
for i in a:
    if i < 3200 and w[i//400]==0:
        count+=1
    w[i//400]+=1
if count == 0:
    print(1,w[8])
elif w[8] == 0:
    print(count,count)
else:
    print(count,count+w[8])

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
a = list(map(int,input().split()))
w = np.zeros(9,dtype=int)
count = 0
for i in a:
    if i < 3200 and w[i//400]==0:
        count+=1
    w[i//400]+=1
if count == 0:
    print(1,w[8])
elif w[8] == 0:
    print(count,count)
else:
    print(count,count+w[8])

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
a = list(map(int,input().split()))
w = np.zeros(9,dtype=int)
count = 0
for i in range(n):
    if a[i] < 3200 and w[a[i]//400]==0:
        count+=1
    w[a[i]//400]+=1
if count == 0:
    print(1,w[8])
elif w[7] == 0:
    print(count,count)
else:
    print(count,count+w[8])

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
a = list(map(int,input().split()))
w = np.zeros(9,dtype=int)
count = 0
for i in range(n):
    if a[i] < 3200 and w[a[i]//400]==0:
        count+=1
    w[a[i]//400]+=1
if count == 0:
    print(1,w[8])
elif w[7] == 0:
    print(count,count)
else:
    print(count,count+w[8])
print(w[8])

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
a = list(map(int,input().split()))
w = np.zeros(9,dtype=int)
count = 0
for i in range(n):
    if a[i] < 3200 and w[a[i]//400]==0:
        count+=1
    w[a[i]//400]+=1
if count == 0 and w[8] <=8:
    print(1,w[8])
elif count == 0:
    print(1,8)
elif w[7] == 0:
    print(count,count)
elif count + w[8] <= 8:
    print(count,count+w[8])
else:
    print(count,count)

Submission status: Runtime Error

Solution code:
n, *A = map(int, open(0).read().split())
c = [0]*9
for a in A:
  c[min(8, a//400)] += 1

cl = 8-c[:-1].count(0)
cmin = max(1, cl)
cmax = min(cl+c[8])
print(cmin, cmax)

Submission status: Runtime Error

Solution code:
n, *A = map(int, open(0).read().split())
c = [0]*9
for a in A:
  c[min(8, a//400)] += 1

print(8-c[:-1].count(0))
print(c[8])
cl = 8-c[:-1].count(0)
cmin = max(1, cl)
cmax = min(cl+c[8])
print(cmin, cmax)

Submission status: Runtime Error

Solution code:
n, *A = map(int, open(0).read().split())
c = [0]*9
for a in A:
  c[min(8, a//400)] += 1

print(c)
cmin = max(1, 8-[c::-1].count(0))
cmax = min(8, cmin+c[8])
print(cmin, cmax)

Submission status: Runtime Error

Solution code:
ans1=sum(1 for x in array[:-1]if x>0)
ans=8-array.count(0)
if array[8]==0:
    ans+=1
else:
    ans+=array[8]
    if ans>8:
        ans=8
if ans1==0:
    ans1+=1

print(ans1,ans)

Submission status: Runtime Error

Solution code:
n=int(input())
s=list(map(int,input().split()))
l=[0 for _ in range(12)]
for x in s:
    l[x//400]+=1
j=sum(r>0 for r in l[:8])
print(j,j+sum(l[8:]))

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x:x//400,A))
#print(A)
C = [0]*9
for a in A:
  if a>=8:
    C[8] +=1
  elif C[a]==0:
    C[a] = 1
#print(C[:-1])
mi = sum(C[:-1])
if mi == 0:
  mini = min(1,C[-1])
ma = min(8,mi+C[-1])
print(mini,ma)

Submission status: Runtime Error

Solution code:
n = int(input())
A = list(map(int, input().split()))
R = [0 for i in range(9)]
for i in range(n):
    R[A[i]//400] += 1
mi = 0
for i in range(8):
    if R[i] > 0: mi += 1
if mi == 0 and R[8] > 0:
    print(mi+1, min(8, mi+R[8]))
else:
    print(mi, min(8, mi+R[8]))

Submission status: Runtime Error

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

dic = [False]*7

cnt = 0

for i in range(n):
  tmp = A[i] // 400
  if(tmp >= 8):
    cnt += 1
  else:
    dic[tmp] = True
  
print(sum(dic))
print(sum(dic) + cnt)

Submission status: Runtime Error

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

dic = [False]*7

cnt = 0

for i in range(n):
  tmp = A[i] // 400
  if(tmp >= 8):
    cnt += 1
  else:
    dic[tmp] = True
  
print(str(sum(dic)) + ' ' + str(sum(dic) + cnt))

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
l =[]
for i in a:
    l.append(i//400)
x = set()
y = 0
for i in l:
    if i< 7:
        x.add(i)
    else:
        y +=1
x = len(x)
if x:
    mi =x
else:
    mi =1
ma =x+y
print('{} {}'.format(mi.ma))

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
l =[]
for i in a:
    l.append(i//400)
x = set()
y = 0
for i in l:
    if i< 7:
        x.add(i)
    else:
        y +=1
x = len(x)
if x:
    mi =x
else:
    mi =1
ma =x+y
print('{}{}'.format(mi.ma))

Submission status: Runtime Error

Solution code:
N = int(input())
X = list(map(int, input().split()))
X = [x//400 for x in X]
min_X = len(set([x for x in X if x < 8]))
max_X = min_X + len([x for x in X if x >= 8])
# この max は気づかないなあ
print(max([min_X, 1], max_X)

Submission status: Runtime Error

Solution code:
n = input()
A = list(map(int, input().split()))
flags = [0] * 8
count = 0
for a in A:
  if a < 3200:
    flags[a // 400] += True
  else:
    counts += 1
print(sum(flags), sum(flags) + count)

Submission status: Runtime Error

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

cnt=0
l=[]
for i in a:
  p=i//400
  if p<=7:
    l.append(p)
  else:
    cnt+=1

d=len(set(l))
if d==0:
  d+=1
print(d,d+cnt)

Submission status: Runtime Error

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

cnt=0
l=[]
for i in a:
  p=i//400
  if p<=7:
    l.append(p)
  else:
    cnt+=1

def=len(set(l))
if def==0:
  def+=1
print(def,def+cnt)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
i=0
check=[0]*8
while i<n and a[i]<3200:
    a_i=a[i]
    for j in range(8):
        if check[j]==0 and a_i>=400*j and a_i<400*(j+1):
            check[j]=1
            break
    i+=1
if sum(check)==0:
    ans_min=1
    ans_max_=n
else:
    ans_min=sum(check)
    ans_max=ans_min+n-i
print(ans_min,ans_max)

Submission status: Runtime Error

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

c = 0
for i in A: c += 1 if i<3200 else 0
Am = set()
for i in A:
    if i<3200:
        Am.add(i//400)

minc = len(Am if c>0 else Am+1)

AM = set([int(v)//400 if v<3200 else i+50 for i, v in enumerate(A)])
maxc = len(AM)

print(minc, maxc)

Submission status: Runtime Error

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

l=[0]*8

for i in range(n):
  if a[i]<399:
    l[0]="t"
  elif a[i]<799:
    l[1]="t"
  elif a[i]<1199:
    l[2]="t"
  elif a[i]<1599:
    l[3]="t"
  elif a[i]<1999:
    l[4]="t"
  elif a[i]<2399:
    l[5]="t"
  elif a[i]<2799:
    l[6]="t"
  elif a[i]<3199:
    l[7]="t"
  else:
    l[8]+=1
countt=l.count("t")

if countr==0:
  print(countt,countt)
else:
  print(max(0,countt-l[8]),min(countt+1,8))

Submission status: Runtime Error

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

l=[0]*8

for i in range(n):
  if a[i]<399:
    l[0]="t"
  elif a[i]<799:
    l[1]="t"
  elif a[i]<1199:
    l[2]="t"
  elif a[i]<1599:
    l[3]="t"
  elif a[i]<1999:
    l[4]="t"
  elif a[i]<2399:
    l[5]="t"
  elif a[i]<2799:
    l[6]="t"
  elif a[i]<3199:
    l[7]="t"
  else:
    l[8]+=1
countt=l.count("t")

if countr=0:
  print(countt,countt)
else:
  print(max(0,countt-l[8]),min(countt+1,8))

Submission status: Runtime Error

Solution code:
ates = list(input().split())

for i in range(len(rates)):
    rates[i] = int(rates[i]) // 400

MAX = 0
MIN = 0
j = 0
while j <= 8:
    for k in range(N):
        if j != 8 and j == rates[k]:
            MAX += 1
            MIN += 1
            break
        elif j == 8 and j <= rates[k]:
            MAX += 1
            if MIN == 0:
                MIN = 1
            continue
    j += 1

print(MIN, MAX)

Submission status: Runtime Error

Solution code:
n = int(input())
A = list(map(int, input().split()))
k = [0]*n
mk = [0]*8
for i in range(n):
    k[i] = A[i]//400
    mk[k[i]-1] += 1
r1 = len(set(k))-min(1, mk[-1])
r2 = r1+mk[-1]
print(str(r1)+" "+str(r2))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
コードテスト - AtCoder Beginner Contest 064.html

Submission status: Runtime Error

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

colors = [0 for _ in range(N + 1)]

for a in A:
    if 1<= a < 400:
        colors[0] = 1
    if 400 <= a < 800:
        colors[1] = 1
    if 800 <= a < 1200:
        colors[2] = 1
    if 1200 <= a < 1600:
        colors[3] = 1
    if 1600 <= a < 2000:
        colors[4] = 1
    if 2000 <= a < 2400:
        colors[5] = 1
    if 2400 <= a < 2800:
        colors[6] = 1
    if 2800 <= a < 3200:
        colors[7] = 1
    if 3200 <= a:
        colors[8] += 1

minimum = sum(colors[:-1])
zero_count = colors.count(0)
over_count = colors[-1]

max = 0
max = min(zero_count, over_count) + minimum

print(minimum, max)

Submission status: Runtime Error

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

l = [0 for i in range(9)]
for a in A:
  ind = 0
  while ind < 9:
    if a < (ind+1)*400:
      break
    ind += 1
  l[ind] += 1

ans_max = 0
ans_min = 0
for i in range(0, 8):
  if l[i] > 0:
    ans_max += 1
    ans_min += 1
if l[-1] > 0:
  ans_max = min(ans_max + l[-1] , 9)
  ans_min = max(ans_min, 1)
print(ans_min, ans_max)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
color = [0 for i in range(9)]
a.sort()
for i in a:
    number = i//400
    color[number] += 1
left = 8 - color[:8].count(0)
right = color[8]
if left == 8:
    print('{} {}'.format(8,8))
else:
    sum_color = left + right
    if sum_color >= 8:
        print('{} {}'.format(left,8))
    else:
        print('{} {}'.format(left,sum_color))

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
rank=[0]*9
for i in a:
    rank[i//400]+=1

s=0
for i in range(8):
    if rank[i]>0:
        s+=1
if s>0:
    s1=s
else:
    s1=1
s2=s+rank[8]
print(s1,s2)

Submission status: Runtime Error

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=[0,0,0,0,0,0,0,0]
red=int(0)
for i in range(n):
    now=int(A[i]/400)
    if now<=8:
        B[now]=1
    else:
        red+=1

ans=B.count(1)
print("{} {}".format(ans,ans+red))

Submission status: Runtime Error

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=[0,0,0,0,0,0,0,0,0]
for i in range(n):
    now=int(A[i]/400)
    B[now]+=1

ans=int(0)
for i in range(8):
    if B[i]>0:
        ans+=1
    
print("{} {}".format(ans,ans+B[8]))

Submission status: Runtime Error

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

D=[0]*9
for s in S:
    s//=400
    D[s]+=1
c=0
for i in range(8):
    if(D[i]==0):
        c+=1
print(8-c,8-c+min(c,D[8]))

Submission status: Runtime Error

Solution code:
 int(input())
a = list(map(int, input().split()))
 
c = [0] * 9
 
for rate in a:
    i = rate // 400
    if i < 8:
        c[i] = 1
    else:
        c[8] += 1
 
c_sum = sum(c[:8])
c_min = max(c_sum, 1)
c_max = c_sum + c[8]
 
print(c_min, c_max)
N = int(input())
a = list(map(int, input().split()))

c = [0] * 9

for rate in a:
    i = rate // 400
    if i < 8:
        c[i] = 1
    else:
        c[8] += 1

c_sum = sum(c[:8])
c_min = max(c_sum, 1)
c_max = c_sum + c[8]

print(c_min, c_max)

Submission status: Runtime Error

Solution code:
 int(input())
a = list(map(int, input().split()))
 
c = [0] * 9
 
for rate in a:
    i = rate // 400
    if i < 8:
        c[i] = 1
    else:
        c[8] += 1
 
c_sum = sum(c[:8])
c_min = max(c_sum, 1)
c_max = c_sum + c[8]
 
print(c_min, c_max)
N = int(input())
a = list(map(int, input().split()))

c = [0] * 9

for rate in a:
    i = rate // 400
    if i < 8:
        c[i] = 1
    else:
        c[8] += 1

c_sum = sum(c[:8])
c_min = max(c_sum, 1)
c_max = c_sum + c[8]

print(c_min, c_max)
提出情報

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
r = [0] * 9
for i in a:
    r[i//400] += 1

c = sum([1 for i in r[:-1] if i != 0])
t = r[-1]

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
r = [0] * 9
for i in a:
    r[i//400] += 1

if sum([1 for i in r[:-1] if i != 0]) == 0:
    print(1, r[-1])

else:
    mi = sum([1 for i in r[:-1] if i != 0])
    ma = mi + r[-1]
    print(mi, ma)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
r = [0] * 9
for i in a:
    r[i//400] += 1

if sum([1 for i in r[:-1] if i != 0]) == 0:
    print(1, n)
else:
    mi = sum([1 for i in r[:-1] if i != 0])
    print(mi, mi+r[-1])

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
r = [0] * 9
for i in a:
    r[i//400] += 1

if sum([1 for i in r[:-1] if i != 0]) == 0:
    print(1, min(8, n))
else:
    mi = sum([1 for i in r[:-1] if i != 0])
    res = 8 - mi
    if res == 0:
        print(mi, mi)
    else:
        if res > r[-1]:
            print(mi, mi+r[-1])
        else:
            print(mi, mi+res)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
r = [0] * 9
for i in a:
    r[i//400] += 1

if r[-1] == 0:
    cnt = sum([1 for i in r[:-1] if i != 0])
    print(cnt, cnt)
else:
    cnt = sum([1 for i in r[:-1] if i != 0])
    res = 8 - cnt
    print(max(cnt, 1), cnt+min(res, r[-1]))

Submission status: Runtime Error

Solution code:
ans = len(set(b))
if (8 in b):
   ans -= 1
   ans2 = b.count(8) + ans
   if (ans == 0):
      print(1, ans2)
   else:
      print(ans, ans2)
else:
   print(ans, ans)

Submission status: Runtime Error

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

print(MIN, MAX)

Submission status: Runtime Error

Solution code:
from collections import defaultdict
N = int(input())
rates = [int(i) for i in input().split()]

color_nums = defaultdict(int)

for rate in rates:
    if rate <= 399:
        color_nums['灰'] += 1
    elif rate <= 799:
        color_nums['茶'] += 1
    elif rate <= 1199:
        color_nums['緑'] += 1
    elif rate <= 1599:
        color_nums['水'] += 1
    elif rate <= 1999:
        color_nums['青'] += 1
    elif rate <= 2399:
        color_nums['黄'] += 1
    elif rate <= 2799:
        color_nums['橙'] += 1
    elif rate <= 3199:
        color_nums['赤'] += 1
    else:
        color_nums['自由'] += 1

free_num = color_nums['自由']
if free_num == 0:
    # 自由に変えられる人がいない場合
    print(len(color_nums), len(color_nums))
elif free_num == N:
    # 自由に変えられる人しかいない場合
    print(min(N, 8), 1)
elif free_num != N:
    # 自由な人と混在
    tmp = dict(free_num)  # コピーを作る
    tmp.pop('自由')
    l_tmp = len(tmp)
    min_num = l_tmp
    max_num = l_tmp + free_num
    print(max_num, min_num)

Submission status: Runtime Error

Solution code:
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

int main(){
    int n;
    int x[9]={0};
    scanf("%d", &n);
    rep(i, 0, n){
        int a, b;
        scanf("%d", &a);
        b = a/400;
        if(b > 8){
            b = 8;
        }
        x[b]++;
    }
    int p=0;
    rep(i, 0, 8){
        //printf("%d ", x[i]);
        if(x[i] > 0){
            p++;
        }
    }
    printf("%d %d", p, p+x[8]);

    return 0;
}

Submission status: Runtime Error

Solution code:
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

int main(){
    int n, x[9]={0};
    scanf("%d", &n);
    rep(i, 0, n){
        int a, b;
        scanf("%d", &a);
        b = a/400;
        if(b > 8){
            b = 8;
        }
        x[b]++;
    }
    int p=0;
    rep(i, 0, 8){
        //printf("%d ", x[i]);
        if(x[i] > 0){
            p++;
        }
    }
    printf("%d %d", p, p+x[8]);

    return 0;
}

Submission status: Runtime Error

Solution code:
N = int( input() )
As = [ map( int, input().split() ) ]

rate = []
anycol = 0
for i in A : 
  if i >= 3200 : 
    anycol += 1 
  else : 
     rate.append( i // 400 )

count = let( set(rate) )

print( max(count, 1), min(count+anycol, 8) )

Submission status: Runtime Error

Solution code:
N=int(input())
a=list(map(int, input().split()))
c=[0]*9
for i in range(N):
  c[a[i]//400]+=1
  
temp=[1 for i in range(8) if c[i]>0]
x=len(temp)
y=min(8, x+c[8])

print(x, y)

Submission status: Runtime Error

Solution code:
N=int(input())
a=list(map(int, input().split()))
c=[0]*9
for i in range(N):
  c[a[i]//400]+=1
  
x=sum([1 for i in range(8) if c[i]>0])
y=min(8, x+c[8])

print(x, y)

Submission status: Runtime Error

Solution code:
#レート
#1-399：灰色
#400-799：茶色
#800-1199：緑色
#1200-1599：水色
#1600-1999：青色
#2000-2399：黄色 
#2400-2799：橙色
#2800-3199：赤色



N = int(input())
scores = sorted(list(map(int,input().split())))
colors = []

color = ""
another = 0

for point in scores:
  if point <= 399:
    color = "gray"
    if color not in colors:
      colors.append(color)
  elif point <= 799 and points :
    color = "brown"
    if color not in colors:
      colors.append(color)
  elif point <= 1199:
    color = "sky"
    if color not in colors:
      colors.append(color)
  elif point <= 1999:
    color = "blue"
    if color not in colors:
      colors.append(color)
  elif point <= 2399:
    color = "yellow"
    if color not in colors:
      colors.append(color)
  elif point <= 2799:
    color = "orange"
    if color not in colors:
      colors.append(color)
  elif point <= 3199:
    color = "red"
    if color not in colors:
      colors.append(color)
  elif point > 3199:
    another += 1
    
ans = len(colors)
if ans == 0:
  print(1,another)
else:
  print(ans,ans + another)

Submission status: Runtime Error

Solution code:
#レート
#1-399：灰色
#400-799：茶色
#800-1199：緑色
#1200-1599：水色
#1600-1999：青色
#2000-2399：黄色 
#2400-2799：橙色
#2800-3199：赤色



N = int(input())
scores = sorted(list(map(int,input().split())))
colors = []

color = ""
another = 0

for point in scores:
  if point <= 399:
    color = "gray"
    if color not in colors:
      colors.append(color)
  elif point <= 799 and points :
    color = "brown"
    if color not in colors:
      colors.append(color)
  elif point <= 1199:
    color = "sky"
    if color not in colors:
      colors.append(color)
  elif point <= 1999:
    color = "blue"
    if color not in colors:
      colors.append(color)
  elif point <= 2399:
    color = "yellow"
    if color not in colors:
      colors.append(color)
  elif point <= 2799:
    color = "orange"
    if color not in colors:
      colors.append(color)
  elif point <= 3199:
    color = "red"
    if color not in colors:
      colors.append(color)
  elif point > 3199:
    another += 1
    
ans = len(colors)

print(ans,ans + another)

Submission status: Runtime Error

Solution code:
N=int(input())
A=[int(x) for x in input().split()]
B=[0]*9
for i in range(N):
  R=A[i]//400
  if R>8:
    R=8
  B[R] +=1
answer_min=0
for i in range(8):
  if not B[i]==0:
    answer_min +=1
answer_max=answer_min+B[8]
if answer_max>8:
  answer_max=8
if answer_min=0:
  answer_min=1
print(answer_min,answer_max)

Submission status: Runtime Error

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

Colors = [0 for _ in range(7)]
any_color = 0

for a in A:
    if a <= 399:
        Colors[0] = 1
    elif a <= 799:
        Colors[1] = 1
    elif a <= 1199:
        Colors[2] = 1
    elif a <= 1599:
        Colors[3] = 1
    elif a <= 1999:
        Colors[4] = 1
    elif a <= 2399:
        Colors[5] = 1
    elif a <= 2799:
        Colors[6] = 1
    elif a <= 3199:
        Colors[7] = 1
    else:
        any_color += 1

ans_min = sum(Colors)
ans_max = sum(Colors) + any_color

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

Submission status: Runtime Error

Solution code:
Nc = input()
N = int(Nc)
cor = ''
c = map(int,input().split())
l = list(c)
l2 = []
l3 = []
maxL = 0

for num in l:
    if 1 <= N <= 100 and 1 <= num <= 4800 and type(num) == int:
        if  1 <= num <= 399:
            cor = 'cinzento'
            l2.append(cor)
        elif 400 <= num <= 799:
            cor = 'castanho'
            l2.append(cor)
        elif 800 <= num <= 1199:
            cor = 'verde'
            l2.append(cor)
        elif 1200 <= num <= 1599:
            cor = 'ciano'
            l2.append(cor)
        elif 1600 <= num <= 1999:
            cor = 'azul'
            l2.append(cor)
        elif 2000 <= num <= 2399:
            cor = 'amarelo'
            l2.append(cor)
        elif 2400 <= num <= 2799:
            cor = 'laranja'
            l2.append(cor)
        elif 2800 <= num <= 3199:
            cor = 'vermelho'
            l2.append(cor)
        else:
            cor = input()
            maxL = maxL+1
            
for color in l2:
    if color not in l3 :
        l3.append(color)
        maxL = maxL+ 1
print(len(l3), maxL)

Submission status: Runtime Error

Solution code:
Nc = input()
N = int(Nc)
cor = ''
c = map(int,input().split())
l = list(c)
l2 = []
l3 = []
maxL = 0


for num in l:
    if 1 <= N <= 100 and 1 <= num <= 4800 and type(num) == int:
        if  1 <= num <= 399:
            cor = 'cinzento'
            l2.append(cor)
        elif 400 <= num <= 799:
            cor = 'castanho'
            l2.append(cor)
        elif 800 <= num <= 1199:
            cor = 'verde'
            l2.append(cor)
        elif 1200 <= num <= 1599:
            cor = 'ciano'
            l2.append(cor)
        elif 1600 <= num <= 1999:
            cor = 'azul'
            l2.append(cor)
        elif 2000 <= num <= 2399:
            cor = 'amarelo'
            l2.append(cor)
        elif 2400 <= num <= 2799:
            cor = 'laranja'
            l2.append(cor)
        elif 2800 <= num <= 3199:
            cor = 'vermelho'
            l2.append(cor)
        else:
            cor = input()
            maxL = maxL+1       
print(l2)
for color in l2:
    if color not in l3 :
        l3.append(color)
        maxL = maxL+ 1
print(len(l3), maxL)