Problem:


Score : 300 points

Problem Statement

In AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:  

Rating 1-399 : gray

Rating 400-799 : brown

Rating 800-1199 : green

Rating 1200-1599 : cyan

Rating 1600-1999 : blue

Rating 2000-2399 : yellow

Rating 2400-2799 : orange

Rating 2800-3199 : red

Other than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.

Currently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.

Find the minimum and maximum possible numbers of different colors of the users.  

Constraints

1 ≤ N ≤ 100

1 ≤ a_i ≤ 4800

a_i is an integer.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

Print the minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.  

Sample Input 1

4
2100 2500 2700 2700

Sample Output 1

2 2

The user with rating 2100 is "yellow", and the others are "orange". There are two different colors.  

Sample Input 2

5
1100 1900 2800 3200 3200

Sample Output 2

3 5

The user with rating 1100 is "green", the user with rating 1900 is blue and the user with rating 2800 is "red".

If the fourth user picks "red", and the fifth user picks "blue", there are three different colors. This is one possible scenario for the minimum number of colors.

If the fourth user picks "purple", and the fifth user picks "black", there are five different colors. This is one possible scenario for the maximum number of colors.  

Sample Input 3

20
800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990

Sample Output 3

1 1

All the users are "green", and thus there is one color.



Sample input:
4
2100 2500 2700 2700


Sample output:
2 2

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
a.sort()
c = []
count = 0
for i in range(n):
    if a[i] < 400:
        c.append(1)
    elif a[i] >= 400 and a[i] < 800:
        c.append(2)
    elif a[i] >= 800 and a[i] < 1200:
        c.append(3)
    elif a[i] >= 1200 and a[i] < 1600:
        c.append(4)
    elif a[i] >= 1600 and a[i] < 2000:
        c.append(5)
    elif a[i] >= 2000 and a[i] < 2400:
        c.append(6)
    elif a[i] >= 2400 and a[i] < 2800:
        c.append(7)
    elif a[i] >= 2800 and a[i] < 3200:
        c.append(8)
    else:
        count = count + n - i
        break
cl = set(c)
if len(cl) > 0:
    print(len(cl),len(cl)+count)
else:
    print(1,n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def main():
    N = int(input())
    a = list(map(int, input().split()))
    colors = [0] * 9 # 8色 + 任意の1色
    for rate in a:
        colors[min(rate // 400, 8)] += 1

    used = 0
    for c in colors[0:8]:
        if c != 0:
            used += 1

    mn = max(used, 1)
    mx = used + colors[8]
    print(mn, mx)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = map(int,input().split())
dict = {
    1: 0,
    2: 0,
    3: 0,
    4: 0,
    5: 0,
    6: 0,
    7: 0,
    8: 0,
    0: 0
}

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

min_c = 0
max_c = 0
for i in range(1, 9):
    if dict[i] > 0:
        min_c += 1
        max_c += 1

v = dict[0]
if v > 0:
    max_c += v
    if min_c == 0:
        min_c = 1

print(min_c, max_c)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
rate = [399+(400)*i for i in range(8)]
rate = rate + [4801]
len_ = len(rate)
count = [0] * len_
for i in range(N):
    for j in range(len_):
        if a[i] <= rate[j]:
            count[j] += 1
            break
colors = 0
for i in range(len_-1):
    if count[i] > 0:
        colors += 1
if colors == 0:
    print(1, count[-1])
else:
    print(colors, colors+count[-1])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = [0] * 9
for i in range(n):
    for j in range(9):
        if 400 * j <= a[i] <= 400 * (j + 1) - 1 and j != 8:
            b[j] += 1
        elif j == 8 and a[i] >= 400 * j:
            b[j] += 1
m = 0
M = 0
for i in range(8):
    if b[i] != 0:
        m += 1
        M += 1
M += b[8]
if m == 0:
    m = 1
print(m, M)

Submission status: Accepted

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

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

color = [False]*8
ans = 0
change = 0
for i in a:
    if 1 <= i <= 399 and not color[0]:
        color[0] = True
        ans += 1
    elif 400 <= i <= 799 and not color[1]:
        color[1] = True
        ans += 1
    elif 800 <= i <= 1199 and not color[2]:
        color[2] = True
        ans += 1
    elif 1200 <= i <= 1599 and not color[3]:
        color[3] = True
        ans += 1
    elif 1600 <= i <= 1999 and not color[4]:
        color[4] = True
        ans += 1
    elif 2000 <= i <= 2399 and not color[5]:
        color[5] = True
        ans += 1
    elif 2400 <= i <= 2799 and not color[6]:
        color[6] = True
        ans += 1
    elif 2800 <= i <= 3199 and not color[7]:
        color[7] = True
        ans += 1
    elif 3200 <= i:
        change += 1
if ans == 0:
    print(1,change)
else:
    print(ans,ans + change)

Submission status: Accepted

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

def main(N, A):
    st = 0
    check = [0]*8
    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
        else:
            st += 1
            
    cnt = check.count(1)
    print(max(1, cnt), cnt+st)
    
if __name__ == '__main__':
    N = int(input())
    A = [int(a) for a in input().split()]
    
    main(N, A)

Submission status: Accepted

Solution code:
from collections import Counter
N=int(input())
a=Counter(list(map(lambda x:int(x)//400,input().split())))
#print(a)
d=a.keys()
if {8,9,10,11,12}&set(a.keys()):
    b=len(set(d)-{8,9,10,11,12})
    #print(b)
    c=sum([a[i] for i in range(8,13)])
    print(max(b,1),(b+c))
else:
    print(len(d),len(d))

Submission status: Accepted

Solution code:
def main():
    _ = int(input())
    A = list(map(int, input().split()))
    c = [False] * (4800 // 400 + 1)
    d = [0] * (4800 // 400 + 1)
    for a in A:
        c[a // 400] = True
        d[a // 400] += 1
    mn = 1 if c[:8].count(True) == 0 else c[:8].count(True)
    mx = c[:8].count(True) + sum(d[8:])
    print(mn, mx)


main()

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
n_o=len([i for i in l if i>=3200])
n_c=len(set([i//400 for i in l if i<3200]))
print(max(1,n_c),n_o+n_c)

Submission status: Accepted

Solution code:
import numpy as np
# 参加人数を入力する
N = int(input())
# レートを入力する
a = list(map(int, input().split()))
# ndarray型に変換
arr_a = np.array(a)
# 3200未満のレートを持つ人について、色の種類数を設定する
under3200 = 0
# 色ごとのレートの下限と上限を設定
lower = 1
upper = 399
# 上限が3200未満である限り繰り返す
while upper < 3200:
    # 範囲内のレートを持つ人がいる場合、色の種類数を増やす
    if len(arr_a[(arr_a  >= lower) & (arr_a <= upper)]) != 0:
        under3200 += 1
    # 下限と上限を更新する
    lower = upper + 1
    upper += 400
# 3200を超えるレートを持つ人の数を数える
over3200 = len(arr_a[arr_a >= 3200])

# 色の種類数の最小値について
if under3200 != 0:
    min_color = under3200
else:
    min_color = 1
# 色の種類数の最大値について
max_color = under3200 + over3200
# 結果を出力する
print("{} {}".format(min_color, max_color))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

N = int(input())
arr = list(map(int, input().split()))
div_arr = list(map(lambda x: x // 400, arr))
sol_arr = [x for x in div_arr if x < 8]
free_len = len(div_arr) - len(sol_arr)
if sol_arr != []:
    min_num = len(set(sol_arr))
    max_num = min_num + free_len
else:
    min_num = 1
    max_num = free_len
print(min_num, max_num)

Submission status: Accepted

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

colors = {
  'gray': 0,
  'blown': 0,
  'green': 0,
  'water': 0,
  'blue': 0,
  'yellow': 0,
  'orange': 0,
  'red': 0,
}
over_3200 = 0

for rate in a:
  if 1 <= rate <= 399:
    colors['gray'] += 1
  elif 400 <= rate <= 799:
    colors['blown'] += 1
  elif 800 <= rate <= 1199:
    colors['green'] += 1
  elif 1200 <= rate <= 1599:
    colors['water'] += 1
  elif 1600 <= rate <= 1999:
    colors['blue'] += 1
  elif 2000 <= rate <= 2399:
    colors['yellow'] += 1
  elif 2400 <= rate <= 2799:
    colors['orange'] += 1
  elif 2800 <= rate <= 3199:
    colors['red'] += 1
  elif rate >= 3200:
    over_3200 += 1

min_kinds = len([i for i in list(colors.values()) if i != 0]) 
max_kinds = min_kinds + over_3200
print(' '.join([str(max([1, min_kinds])), str(max_kinds)]))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
c=[0]*8
sums=0
sai=0
for i in a:
    if i<3200:
        c[i//400]=1
    else:
        sai+=1
sums=sum(c)
print(max(1,sums),sums+sai)

Submission status: Accepted

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

rank = [0]*9

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

sum = 0

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

min = sum
max = sum + rank[8]

if min == 0:
  min = 1

print(min,max)

Submission status: Accepted

Solution code:

N = int(input())

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


dic = {}
free = 0

for i in a:

    if i // 400 < 8:

        dic[i//400] = 1

    else:

        free += 1

print( max(1,len(dic)) ,  len(dic) + free )

Submission status: Accepted

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

minans=0
miniro=[0]*8
count=0

for i in range(n):
    tmp=a[i]//400
    if tmp<8 and miniro[tmp]==0:
        miniro[tmp]=1
    elif tmp>=8:
        count+=1

print("{0} {1}".format(max(sum(miniro),1), count+sum(miniro)))

Submission status: Accepted

Solution code:
n=int(input())
a=sorted([int(i) for i in input().split()])
color=[0]*9
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:
        color[8]+=1
print("{} {}".format((sum(color[:8]) if sum(color[:8])>0 else 1),sum(color)))

Submission status: Accepted

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

color=[0]*9
for i in range(n):
  if(hoge[i]<3200):
    color[hoge[i]//400]+=1
  else:
    color[8]+=1

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

if(color[8]==n):
  print(1,n)
else:
  print(ans,ans+color[8])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# C
import collections
N = int(input())
a = list(map(int, input().split()))
def color(rate):
    if 1 <= rate <= 400:
        return 'gray'
    elif 400 <= rate < 800:
        return 'brown'
    elif 800 <= rate < 1200:
        return 'green'
    elif 1200 <= rate < 1600:
        return 'mizu'
    elif 1600 <= rate < 2000:
        return 'blue'
    elif 2000 <= rate < 2400:
        return 'yellow'
    elif 2400 <= rate < 2800:
        return 'orange'
    elif 2800 <= rate < 3200:
        return 'red'
    else:
        return 'change'
color_lst = []
change_num = 0
for i in range(N):
    tmp = color(a[i])
    if tmp == 'change':
        change_num += 1
    else:
        color_lst.append(tmp)
color_counter = collections.Counter(color_lst)
num = color_counter.keys()
if len(num) != 0:
    print('{} {}'.format(len(num), len(num) + change_num))
else:
    print('{} {}'.format(1, change_num))

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  l2=[400,800,1200,1600,2000,2400,2800,3200]
  l3=[0]*9

  for x in l:
    l3[bisect.bisect_right(l2,x)]+=1

  # print(l3)

  sm=0
  for x in l3[:-1]:
    if x!=0:
      sm+=1

  if sm==0:
    print(1,l3[-1])
  else:
    print(sm,sm+l3[-1])

main()

Submission status: Accepted

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

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

cnt = 0

for s in a:
    if s >= rate[-1]:
        cnt += 1
        continue
    
    cont = True
    i = 0

    while cont:
        if  s < rate[i+1]:
            a_ac[i] = 1
            cont = False
        i += 1

print(max(1,sum(a_ac)))
print(sum(a_ac)+cnt)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
cnt = [0 for i in range(8)]
meta = 0
for i in range(n):
    if a[i] >= 3200:
        meta += 1
    else:
        cnt[a[i]//400] = 1
if sum(cnt) == 0:
    print(1, meta)
else:
    print(sum(cnt), sum(cnt)+meta)

Submission status: Accepted

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

color = []
over = 0
for rate in A:
    if rate >= 3200:
        over += 1
    else:
        num = int(rate / 400)  # 0 ~ 7
        color.append(num)

color = set(color)
if len(color) == 0:
    mini = 1
    maxi = over

else:
    mini = len(color)
    maxi = mini + over
print("{} {}".format(mini, maxi))

Submission status: Accepted

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

print(str(m)+' '+str(M))

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
M = 8
count = [0] * (M + 1)
for x in a:
    q = min(x // 400, M)
    count[q] += 1
nonzero = 0
for i in range(M):
    if count[i] > 0:
        nonzero += 1
print(max(nonzero, 1), nonzero + count[M])

Submission status: Accepted

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

L=[0]*9
for a in A:
    if a//400<=7:
        L[a//400]=1
    else:
        L[8]+=1

if sum(L[:-1])==0:
    print(1,sum(L))
else:
    print(sum(L[:-1]),sum(L))

Submission status: Accepted

Solution code:
N=int(input())
rates=[0]*8
topcoder=0

for a_ in input().split():
    a=int(a_)
    if 1<=a<=399:
        rates[0]=1
    elif 400<=a<=799:
        rates[1]=1
    elif 800<=a<=1199:
        rates[2]=1
    elif 1200<=a<=1599:
        rates[3]=1
    elif 1600<=a<=1999:
        rates[4]=1
    elif 2000<=a<=2399:
        rates[5]=1
    elif 2400<=a<=2799:
        rates[6]=1
    elif 2800<=a<=3199:
        rates[7]=1
    else:
        topcoder+=1

rate_n=rates.count(1)
print(max(1,rate_n), rate_n+topcoder)

Submission status: Accepted

Solution code:
# ABC064C - Colorful Leaderboard
from collections import Counter


def main():
    n = int(input())
    cnt = Counter(i // 400 for i in tuple(map(int, input().rstrip().split())))
    colored = sum(i < 8 for i in cnt.keys())  # rate: <3200
    free = sum(j if i >= 8 else 0 for i, j in cnt.items())  # >=3200
    x = max(1, colored)  # min
    y = colored + free  # max
    print(x, y)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

def main():
    num = int(input())
    data = list(map(int, input().split()))

    color = [0 for i in range(9)]
    for i in range(num):
        score = data[i]
        ind = score // 400
        if ind > 8:
            ind = 8
        color[ind] += 1

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

    min_data = max(1, now_data)
    # max_data = min(8, now_data + color[8])
    max_data = now_data + color[8]
    print(min_data, max_data)





if __name__ == '__main__':
    main()

Submission status: Accepted

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

def main():
    b = 400
    limit = 8
    rates = list(map(lambda n: min(limit, n // b), A))
    min_count = 0
    for i in range(limit):
        min_count += 1 if rates.count(i) else 0
    print(max(1, min_count), min_count + rates.count(limit))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

d = defaultdict(int)

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

cnt=0
joker=0
for i in d.keys():
    if i != 8:
        cnt+=1
    else:
        joker=d[8]

ans_min = max(cnt,1)
ans_max = cnt+joker


print(ans_min,ans_max)

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()
A = nl()

colors = set()
overs = 0
for a in A:
    if a <= 399:
        colors.add(1)
    elif a <= 799:
        colors.add(2)
    elif a <= 1199:
        colors.add(3)
    elif a <= 1599:
        colors.add(4)
    elif a <= 1999:
        colors.add(5)
    elif a <= 2399:
        colors.add(6)
    elif a <= 2799:
        colors.add(7)
    elif a <= 3199:
        colors.add(8)
    else:
        overs += 1

if len(colors) > 0:
    print(len(colors), len(colors) + overs)
else:
    print(1, overs)

Submission status: Accepted

Solution code:
num = int(input())
arr = list(map(int, input().split()))

colors = [0]*8
special = 0

for rate in arr:
    if rate < 400:
        colors[0]=1
    elif rate < 800:
        colors[1]=1
    elif rate < 1200:
        colors[2]=1
    elif rate < 1600:
        colors[3]=1
    elif rate < 2000:
        colors[4]=1
    elif rate < 2400:
        colors[5]=1
    elif rate < 2800:
        colors[6]=1
    elif rate < 3200:
        colors[7]=1
    else:
        special += 1

min_kind = sum(colors)
max_kind = min_kind + special
if min_kind==0:
    min_kind=1
print(min_kind, max_kind)

Submission status: Accepted

Solution code:
n=int(input())
al=list(map(int,input().split()))
tl=[0]*9
for a in al:
    if a<3200:
        tl[a//400]|=1
    else:
        tl[8]+=1
print(sum(tl[0:-1]) if sum(tl[0:-1])>0 else 1,sum(tl))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
color = [0 for i in range(9)]
for e in a:
  if e>=3200:
    color[8] += 1
  else:
    color[e//400] += 1
min_ = 0
for e in color[:8]:
  if e:
    min_ += 1
print(max(1, min_), min_+color[8])

Submission status: Accepted

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

Submission status: Accepted

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

if N == 1:
    print(1)
    exit()

buff = [0 for i in range(9)]
for i in range(N):
    if a[i] < 3200:
        buff[a[i] // 400] += 1
    else:
        buff[8] += 1

zero_c = 0
noz_c = 0

for i in range(8):
    if buff[i] == 0:
        zero_c += 1
    else:
        noz_c += 1

# 最小値
ans_m = 0
if noz_c > 0:
    ans_m = noz_c
elif buff[8] > 0:
    ans_m = 1

ans_mx = 0
ans_mx = noz_c + buff[8]
# # 最大値
# if noz_c > 0:
#     ans_mx = noz_c
#     amari = 9 - ans_mx
#     if amari <= buff[8]:
#         ans_mx += amari
#     elif amari > buff[8]:
#         ans_mx += buff[8]
# else:
#     if 9 <= buff[8]:
#         ans_mx = 9
#     else:
#         ans_mx = buff[8]

print(ans_m, ans_mx)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int, a: "List[int]"):
    tmp = 0
    s = set()
    for v in a:
        if v >= 3200:
            tmp += 1
        else:
            s.add(v // 400)
    ret = len(s)
    print(max(1, ret),  ret + tmp)
    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: Accepted

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

a.sort()
color = [-1] * N
for i in range(N):
    if a[i] < 400:
        color[i] = 1
    elif a[i] < 800:
        color[i] = 2
    elif a[i] < 1200:
        color[i] = 3
    elif a[i] < 1600:
        color[i] = 4
    elif a[i] < 2000:
        color[i] = 5
    elif a[i] < 2400:
        color[i] = 6
    elif a[i] < 2800:
        color[i] = 7
    elif a[i] < 3200:
        color[i] = 8
    else:
        color[i] = 9

A = set(color)
if 9 in A:
    A.remove(9)

print(max(1, len(A)), len(A) + color.count(9))

Submission status: Accepted

Solution code:
n = int(input())

color = [0] * 8
pro = 0
for ai in map(int, input().split()):
    if 1 <= ai <= 399:
        color[0] = 1
    elif 400 <= ai <= 799:
        color[1] = 1
    elif 800 <= ai <= 1199:
        color[2] = 1
    elif 1200 <= ai <= 1599:
        color[3] = 1
    elif 1600 <= ai <= 1999:
        color[4] = 1
    elif 2000 <= ai <= 2399:
        color[5] = 1
    elif 2400 <= ai <= 2799:
        color[6] = 1
    elif 2800 <= ai <= 3199:
        color[7] = 1
    else:
        pro += 1

colSum = sum(color)
if colSum == 0 and pro > 0:
    print(1, pro)
else:
    print(colSum, colSum + pro)

Submission status: Accepted

Solution code:
#coding; utf-8


def main():
    N = int(input())
    A = list(map(int, input().split()))
    min_color = 0
    max_color = 0
    rate_criteria = 400
    rate = [0]*9
    for i in range(N):
        diva = A[i]//rate_criteria
        if diva > 8:
            diva = 8
        rate[diva] += 1

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

    if min_color == 0 and rate[-1] > 0:
        min_color = 1
        max_color = rate[-1]
    else:
        max_color = min_color + rate[-1]
    # print(rate)
    print(min_color, max_color)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
s = input().split()
a = [0]*8
flex = 0
for i in range(N):
    if int(s[i]) >=3200 : 
        flex = flex+1
    elif int(s[i]) >= 2800:
        a[7] = a[7]+1
    elif int(s[i])>=2400:
        a[6] = a[6]+1
    elif int(s[i])>=2000:
        a[5] = a[5]+1
    elif int(s[i]) >= 1600:
        a[4] = a[4]+1
    elif int(s[i])>=1200:
        a[3] = a[3]+1
    elif int(s[i])>=800:
        a[2] = a[2]+1
    elif int(s[i])>=400:
        a[1] = a[1] + 1
    else:
        a[0] = a[0]+1

cnt = 0
for i in range(8):
    if a[i] > 0:
        cnt = cnt+1
#print(a)
if  cnt !=  0:
    print(str(cnt)+" "+str(cnt+flex))
else:
    print(str(1)+" "+str(flex))

Submission status: Accepted

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

c=[0]*9
for i in range(N):
    c[min(8,a[i]//400)]+=1
cnt=0
for i in range(8):
    if c[i]>0:
        cnt+=1
if cnt==0:
    cnt=1
    c[8]-=1
minimum=cnt
maximum=cnt+c[8]
print(minimum,maximum)

Submission status: Accepted

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

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

if sum(color_list) == 0:
    color_list[0] = 1
    magic -= 1

minimum = len(list(filter(lambda x: x > 0, color_list)))

print(str(minimum) + " " + str(minimum+magic))

Submission status: Accepted

Solution code:
n=int(input())
rates=list(map(int,input().split()))
over3200=sum(1 for i in rates if i>=3200)
fixed=set()
for i in rates:
  if i//400<=7:
    fixed.add(i//400)
f=len(fixed)
if f==0:
  print(1,over3200)
else:
  print(f,f+over3200)

Submission status: Accepted

Solution code:
n = int(input())
color = {}
wild = 0
a = [int(i) for i in input().split()]
for i in range(n):
  if a[i] < 400:
    color[0] = 1
  elif a[i] < 800:
    color[1] = 1
  elif a[i] < 1200:
    color[2] = 1
  elif a[i] < 1600:
    color[3] = 1
  elif a[i] < 2000:
    color[4] = 1
  elif a[i] < 2400:
    color[5] = 1
  elif a[i] < 2800:
    color[6] = 1
  elif a[i] < 3200:
    color[7] = 1
  else:
    wild += 1

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
aa=[0]*9
for i in range(n):
    x = a[i]//400
    if x<8:
        aa[x] = 1
    else:
        aa[8] += 1
suma = sum(aa[0:8])
if suma==0:
    mina = 1
else:
    mina = suma
maxa = suma+aa[8]
print(mina,maxa)

Submission status: Accepted

Solution code:
N = int(input())

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

lst = [0] * 9

for i in range(N):
    lst[min(a[i]//400, 8)] += 1

count = lst[:8].count(0)

kind_max = min(8-count+lst[8], 100)
kind_min = max(8-count,1)

print (kind_min, kind_max)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  a=[1,400,800,1200,1600,2000,2400,2800,3200]
  b=[0]*9
  c=0
  for x in l:
    for i in range(len(a)-1):
      if a[i]<=x and x<a[i+1]:
        b[i]+=1

    if 3200<=x:
      c+=1

  d=0
  for x in b:
    if x>0:
      d+=1

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

main()

Submission status: Accepted

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

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

for a in A:
	res = min(a//400,8)
	rank[res] += 1

ans = 0
for r in rank[:-1]:
	if r == 0:
		continue
	ans+=1

min_ans = 0
max_ans = 0

if ans == 0:
	min_ans = 1
	max_ans = rank[-1]
else:
	min_ans = ans
	max_ans = ans+rank[-1]
# print(rank)
print(min_ans,max_ans)

Submission status: Accepted

Solution code:
N = int(input())


c = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]

i = 0
cnt = 0
ansOne = 0
ansAny = 0
for ai in sorted(map(int, input().split())):
  while i < len(c):
    if ai <= c[i]:
      cnt += 1
      break
    else:
      if cnt > 0:
        ansOne += 1
        cnt = 0
      i+=1
    
  else:
    ansAny += 1

if ansAny <= 0:
  ansOne += 1
print("{} {}".format(max(ansOne, 1), ansOne + ansAny))

Submission status: Accepted

Solution code:
n = int( input() );
a = input().split(" ");
flag = [0]*8;
count_pro = 0;
for i in range(n) :
	if int(a[i]) < 3200 :
		flag[int(int(a[i])/400)] = 1;
	else :
		count_pro = count_pro + 1;
mi = 0;
mx = 0;
if sum(flag) == 0 :
	mi = 1;
else :
	mi = sum(flag);

#if count_pro > 8 - sum(flag) :
#	mx = 8;
#else :
mx = sum(flag)+count_pro;

print(mi,mx)

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
s=set()
pro=0
for x in l:
	div=x//400
	if div<8:s.add(div)
	else:pro+=1
print(len(s) if pro!=n else 1,len(s)+pro)

Submission status: Accepted

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

color = [0] * 8
ext = 0
for i in range(N):
    for j in range(1,9):
        if a[i] < (j*400):
            color[j-1] += 1
            break
    else:
        ext += 1 
        
        
cnt = 0
for i in color:
    if i > 0:
        cnt += 1
        
minim = max(0,cnt+1 * int(ext>0 and cnt == 0))
maxim = cnt+ext

print(minim,maxim)

Submission status: Accepted

Solution code:
N = int(input())
*A, = map(int, input().split())
colors = [False]*8
changeable = 0
for a in A:
    q, _ = divmod(a, 400)
    if q < 8:
        colors[q] = True
    else:
        changeable += 1
c = sum(colors)
print(c if c > 0 else 1, c + changeable)

Submission status: Accepted

Solution code:
N = int(input())
*A, = map(int, input().split())
colors = [False]*8
changeable = 0
for a in A:
    q, _ = divmod(a, 400)
    if q < 8:
        colors[q] = True
    else:
        changeable += 1
c = sum(colors)
print(c if c > 0 else 1, sum(colors) + changeable)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
flag = [False for _ in range(8)]
flex = 0
for x in a:
    if x >= 3200:
        flex += 1
    else:
        flag[int(x/400)] = True
les = flag.count(True)
if les == 0 and flex > 0:
    print("1 {}".format(flex))
else:
    print("{} {}".format(les, les+flex))

Submission status: Accepted

Solution code:
n = int(input())

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

colors = [0] * 8
over = 0

for score in scores:
    if score < 3200:
        colors[score // 400] += 1
    else:
        over += 1

ans = sum(color > 0 for color in colors)

if ans:
    print(ans, ans + over)
else:
    print(1, over)

Submission status: Accepted

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

"""
min : 3200以上の人間が既出の色にする
max : 3200以上の人間が出来るだけ出ていない色にすru
"""
color = [i//400 for i in para]
ans = []
cnt = 0
cnt_g = 0
for i in range(N):
    if color[i] >= 8 :
        cnt_g += 1
    else : 
        if  color[i] in ans : pass
        else: ans.append(color[i])
        

max_val = len(ans) + cnt_g
min_val = 0
if len(ans) >= 1 : min_val = len(ans)
else : min_val = 1
print("{} {}".format(min_val,max_val))