Problem:


Score : 300 points

Problem Statement

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

Rating 1-399 : gray

Rating 400-799 : brown

Rating 800-1199 : green

Rating 1200-1599 : cyan

Rating 1600-1999 : blue

Rating 2000-2399 : yellow

Rating 2400-2799 : orange

Rating 2800-3199 : red

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

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

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

Constraints

1 ≤ N ≤ 100

1 ≤ a_i ≤ 4800

a_i is an integer.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

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

Sample Input 1

4
2100 2500 2700 2700

Sample Output 1

2 2

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

Sample Input 2

5
1100 1900 2800 3200 3200

Sample Output 2

3 5

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

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

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

Sample Input 3

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

Sample Output 3

1 1

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



Sample input:
4
2100 2500 2700 2700


Sample output:
2 2

Submission status: Accepted

Solution code:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
##############################

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

ans_min = 0
ans_max = 0
colors = [0] * 8

def get_colors(num):
    if num <= 399:
        return 0
    elif num <= 799:
        return 1
    elif num <= 1199:
        return 2
    elif num <= 1599:
        return 3
    elif num <= 1999:
        return 4
    elif num <= 2399:
        return 5
    elif num <= 2799:
        return 6
    elif num <= 3199:
        return 7
    else:
        return -1

all = 0
for i in range(N):
    color = get_colors(A[i])
    if color == -1:
        all += 1
    else:
        colors[color] += 1

# all は「好きな色」に変えることができる！（レートの色以外でもいい）

x = colors.count(0)
# 自由選択できない
if all == 0:
    ans_min = 8-x
    ans_max = 8-x
else:
    if x == 8:
        # all しかない
        ans_min = 1
        ans_max = all
    else:
        # 混合
        ans_min = 8-x
        ans_max = ans_min+all

print(ans_min, ans_max)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
c = []
w = []
for i in range(n):
  t = a[i]//400
  if t < 8 and t not in c:
    c.append(t)
  if t>=8:
    w.append(t)

if len(c)==0 and len(w) >0:
  print(1, len(w))
else:
  print(len(c), len(c)+len(w))

Submission status: Accepted

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

f=0
for i in a:
  if i//400<=7:
    b[i//400]=1
  else:
    f+=1    
    
sb=sum(b)
print(max(sb,1),sb+f)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
reet = [(1,399),(400,799),(800,1199),(1200,1599),
        (1600,1999),(2000,2399),(2400,2799),(2800,3199)]
n = int(input())
alist = list(map(int, input().split()))
 
dorei = []
osama = 0
for a in alist:
    osamaflag = True
    for i in range(len(reet)):
       	bottom, top = reet[i]
        if (bottom <= a <= top):
            dorei.append(i)
            osamaflag = False
            break
    if osamaflag:
        osama += 1

min_ = len(set(dorei))
if min_ == 0:
    min_ = 1
max_ = len(set(dorei)) + osama
print(min_, max_)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a=open(0)
s=set();x=0
for i in map(int,a.split()):
	j=i//400
	if j<8:s.add(j)
	else:x+=1
print(max(1,len(s)),len(s)+x)

Submission status: Accepted

Solution code:
from collections import Counter as C
n=int(input())
A=sorted(C(list(map(lambda x:min(x//400,8),list(map(int,input().split()))))+[8]).most_common())
print(len(A)-1 if A[0][0]!=8 else 1,len(A)+A[-1][1]-2)

Submission status: Accepted

Solution code:
N = int(input())
rate = [0] * 9
for a in [int(x) for x in input().split()]:
  rate[min(a, 3200) // 400] += 1

ret = 0
for r in rate[:-1]:
  if r:
    ret += 1

print(max(ret, 1), ret + rate[-1])

Submission status: Accepted

Solution code:
N,*A=map(int,open(0).read().split());l=[0]*9
for a in A:l[min(8,a//400)]+=1
m=sum([0<l[i]for i in range(8)]);print(max(m,1),m+l[8])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
c = 0
s = set()

for a in A:
  if a >= 3200:
    c += 1
  else:
    s.add(a//400)
print(max(1, len(s)), len(s) + c)

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))
d = {}
for i in range(n):
  if 1<=l[i]<=399:
    a = 0
  elif 400<=l[i]<=799:
    a = 1
  elif 800<=l[i]<=1199:
    a = 2
  elif 1200<=l[i]<=1599:
    a = 3
  elif 1600<=l[i]<=1999:
    a = 4
  elif 2000<=l[i]<=2399:
    a = 5
  elif 2400<=l[i]<=2799:
    a = 6
  elif 2800<=l[i]<=3199:
    a = 7
  else:
    a = 8
  if a in d:
    d[a] += 1
  else:
    d[a] = 1
if not(8 in d):
  print(len(d.keys()), len(d.keys()))
else:
  if len(d.keys()) == 1:
    print(len(d.keys()), len(d.keys())-1+d[8])
  else:
    print(len(d.keys())-1, len(d.keys())-1+d[8])

Submission status: Accepted

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

for i in range(N):
	tmp = A[i] // 400
	if tmp >= 9:
		tmp = 8
	flg[tmp] += 1

if flg[8] == 0:
	n = 9-flg.count(0)
	print(n, end = " ")
	print(n)
else:
	n = 8-flg.count(0)
	if n == 0:
		print(1, end=" ")
		print(flg[8])
	else:
		print(n, end = " ")
		print(n+flg[8])

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    over3200 = len([ai for ai in a if ai >= 3200])
    c = set([ai // 400 for ai in a if ai < 3200])
    print(max(1, len(c)), len(c) + over3200)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n = I()
L = LI()
cnt = 0
s = set()
for i in L:
    if i >= 3200:
        cnt += 1
    else:
        s.add(i // 400)


print(max(1, len(s)), len(s) + cnt)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
c = []
s = 0
for i in range(N):
  c.append(min(a[i]//400, 8))
import collections
colors = collections.Counter(c)
for i in range(8):
  if colors.get(i, 0) != 0:
    s += 1
ss = colors.get(8, 0)

print(max(s, 1), s+ss)

Submission status: Accepted

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

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

    rank = [400*(i+1) for i in range(8)] + [10000]
    count = [0] * len(rank)

    for i in range(N):
        for j in range(len(rank)):
            if a[i] < rank[j]:
                count[j] += 1
                break
    ans = 0
    for i in range(len(count) - 1):
        if count[i] > 0:
            ans += 1
    if ans == 0:
        print(1, count[-1])
    else:
        print(ans, ans+count[-1])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N=int(input())
A=map(int,input().split())
c=0
s=set()
for a in A:
  if a>=3200:
    c+=1
  else:
    s.add(a//400)
print(max(1,len(s)),len(s)+c)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
gray=0
brown=0
green=0
light=0
blue=0
yellow=0
orange=0
red=0
god=0
for a in A:
  if 1<=a and a<=399 and gray==0:
    gray=1
  elif 400<=a and a<=799 and brown==0:
    brown=1
  elif 800<=a and a<=1199 and green==0:
    green=1
  elif 1200<=a and a<=1599 and light==0:
    light=1
  elif 1600<=a and a<=1999 and blue==0:
    blue=1
  elif 2000<=a and a<=2399 and yellow==0:
    yellow=1
  elif 2400<=a and a<=2799 and orange==0:
    orange=1
  elif 2800<=a and a<=3199 and red==0:
    red=1
  elif a>=3200:
    god+=1
mi=max(1,gray+brown+green+light+blue+yellow+orange+red)
ma=gray+brown+green+light+blue+yellow+orange+red+god
print(mi,ma)

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
A = np.array(list(map(int,input().split())))
#print(A)

#print(np.where(A >= 3200))
a = len(np.where(A >= 3200)[0])
#print(A[A < 3200] // 400)
b = len(set(A[A < 3200] // 400))

print(max(1, b), b+a)

Submission status: Accepted

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

cnt_list =[0]*9

cnt_sum=0
num_min=0
num_max=0


for i in a:
    j=int(i/400)
    if j<8:cnt_list[j]=1
    else:cnt_list[8]+=1

      
cnt_sum = sum(cnt_list)-cnt_list[8]
if cnt_list[8]>0:
    if cnt_sum==0:
        num_min=1
    else:num_min=cnt_sum
    num_max=cnt_sum+cnt_list[8]
else:
    num_min=cnt_sum
    num_max=cnt_sum

print(num_min, num_max)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
dic={}
check8=0
for i in a:
    check=i//400
    if check not in dic and check <8:
        dic[check]=1
    if check>=8:
        check8+=1

mi=max(1,len(dic))
ma=len(dic)+check8
print(mi,ma)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
color = {}
f = 0
for a in A:
    if 1 <= a <= 399:
        color['g'] = 1
    elif 400 <= a <= 799:
        color['br'] = 1
    elif 800 <= a <= 1199:
        color['gr'] = 1
    elif 1200 <= a <= 1599:
        color['m'] = 1
    elif 1600 <= a <= 1999:
        color['b'] = 1
    elif 2000 <= a <= 2399:
        color['y'] = 1
    elif 2400 <= a <= 2799:
        color['o'] = 1
    elif 2800 <= a <= 3199:
        color['r'] = 1
    else:
        f += 1
print(max(1, len(color)), len(color)+f)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
s = set()
free = 0
for ai in a:
    rank = ai // 400
    if rank > 7:
        free += 1
    else:
        s.add(rank)

if len(s) == 0:
    ans = (1, free)
else:
    ans = (len(s), len(s) + free)

print(*ans)

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))
rate_dict = defaultdict(int)
for a in A:
    if 1 <= a <= 399:
        rate_dict["gray"] += 1
    elif 400 <= a <= 799:
        rate_dict["brown"] += 1
    elif 800 <= a <= 1199:
        rate_dict["green"] += 1
    elif 1200 <= a <= 1599:
        rate_dict["light_blue"] += 1
    elif 1600 <= a <= 1999:
        rate_dict["blue"] += 1
    elif 2000 <= a <= 2399:
        rate_dict["yellow"] += 1
    elif 2400 <= a <= 2799:
        rate_dict["orange"] += 1
    elif 2800 <= a <= 3199:
        rate_dict["red"] += 1
    elif 3200 <= a:
        rate_dict["free"] += 1
ans = sum([1 if x in rate_dict else 0
           for x in ["gray", "brown", "green", "light_blue", "blue", "yellow", "orange", "red"]])
min_ans = ans
if "free" in rate_dict:
    if len(set(list(rate_dict.keys()))) == 1:
        min_ans = 1
    max_ans = ans + rate_dict["free"]
else:
    max_ans = min_ans
print("{} {}".format(min_ans, max_ans))

Submission status: Accepted

Solution code:
from collections import defaultdict

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

rate = defaultdict(int)

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

valiable = len(rate.keys())
topcoder = rate[9]

if topcoder:
    if valiable == 1:
        print(1, min(topcoder, 9))
    else:
        print(valiable - 1, valiable + topcoder - 1)
else:
    print(valiable, valiable)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
colors = [0]*9
for i in a:
    idx = i//400
    if(idx > 8):
        idx = 8
    colors[idx] += 1
ans = 0
for i in colors[0:8]:
    if i != 0:
        ans += 1
if ans == 0:
    print(1, colors[8])
else:
    print(ans, ans+colors[8])

Submission status: Accepted

Solution code:
bound = [3200, 2800, 2400, 2000, 1600, 1200, 800, 400, 1]
d = {b: 0 for b in bound}

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

for a in A:
    for b in bound:
        if b <= a:
            d[b] += 1
            break

mini = 0
for b in bound[1:]:
    if d[b] > 0:
        mini += 1

print(max(mini, 1), mini + d[3200])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
B = [x//400 for x in A if x//400 <= 7]
num_l = len(B)
var_l = len(set(B))
print(max(1,var_l),var_l+N-num_l)

Submission status: Accepted

Solution code:
from collections import Counter

n = int(input())
a = list(map(lambda a: int(a) // 400, input().split()))
for i in range(n):
    if a[i] >= 8:
        a[i] = 8
c = Counter(a)
if 8 in c:
    print("{} {}".format(
        max(len(c) - 1, 1),
        len(c) - 1 + c[8]))
else:
    print("{} {}".format(
        len(c), len(c)))

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
rate=[0,0,0,0,0,0,0,0,0]
for i in a:
    if i<400:
        rate[0]=1
    elif 400<=i<800:
        rate[1]=1
    elif 800<=i<1200:
        rate[2]=1
    elif 1200<=i<1600:
        rate[3]=1
    elif 1600<=i<2000:
        rate[4]=1
    elif 2000<=i<2400:
        rate[5]=1
    elif 2400<=i<2800:
        rate[6]=1
    elif 2800<=i<3200:
        rate[7]=1
    else:
        rate[8]+=1
color=rate[:8]
x=color.count(1)
color_max=x+rate[8]
if x==0 and rate[8]>0:
    color_min=1
else:
    color_min=x
print('{} {}'.format(color_min,color_max))

Submission status: Accepted

Solution code:
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

def judge(num):
    return bisect_right(rate, num) - 1


rate = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, float("inf")]
li = [0] * 9
n = ni()
aaa = na()
for a in aaa:
    idx = judge(a)
    if idx == 8:
        li[idx] += 1
    else:
        li[idx] = 1
c = max(sum(li[:-1]), 1)
if sum(li[:-1]) == 0:
    print(c, li[-1])
else:
    print(c, c + li[-1])

Submission status: Accepted

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):
    if 1 <= a[i] <= 399:
        color[0] = 1
    elif 400 <= a[i] <= 799:
        color[1] = 1
    elif 800 <= a[i] <= 1199:
        color[2] = 1
    elif 1200 <= a[i] <= 1599:
        color[3] = 1
    elif 1600 <= a[i] <= 1999:
        color[4] = 1
    elif 2000 <= a[i] <= 2399:
        color[5] = 1
    elif 2400 <= a[i] <= 2799:
        color[6] = 1
    elif 2800 <= a[i] <= 3199:
        color[7] = 1
    else:
        color[8] += 1
co = color[:8]
zero = co.count(0)
one = co.count(1)
max = one + color[8]

if one == 0 and color[8] > 0:
    min = 1
else:
    min = one

print("{} {}".format(min, max))

Submission status: Accepted

Solution code:
n=int(input())
def f(x):
  return x//400 if x<3200 else 8
l=list(map(f,list(map(int,input().split()))))
ds=l.count(8)
sl=set(l)
if ds==0:
  print(len(sl),len(sl))
elif len(sl)==1:print(1,ds)
else:
  print(len(sl)-1,len(sl)+ds-1)

Submission status: Accepted

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

cr = []
MAxans = 0

for i in A:
    c = i // 400
    if c < 8 and not c in cr:
        cr.append(c)
    elif c >= 8:
        MAxans += 1


if len(cr)>0:
    Minans = len(cr)
    MAxans = MAxans + Minans
else:
    Minans = 1
print(str(Minans) + " " + str(MAxans))

Submission status: Accepted

Solution code:
import math

n=int(input())
a=list(map(int, input().split()))  
b=[]
count=0




for i in range(n):
    if a[i]>=3200:
        count+=1
    else:
        b.append(a[i]//400)

ans=len(set(b))

if count==0:
    print(ans,ans)

else:
    if ans==0:
        print(1,count)
        
    else:
        print(ans,ans+count)

Submission status: Accepted

Solution code:
from bisect import bisect
def grade(rate,breakpoints=[400,800,1200,1600,2000,2400,2800,3200],grades=["gray","brown","green","light blue","blue","yellow","orange","red","anything"]):
    i = bisect(breakpoints,rate)
    return grades[i]

n = int(input())
a = [int(i) for i in input().split()]
colors = [grade(r) for r in a]
anything_count = colors.count("anything")
ans = len(set(colors))
print(*(ans,ans) if anything_count == 0 else (ans-1+(1 if ans == 1 else 0),ans-1+anything_count))

Submission status: Accepted

Solution code:
_ = input().strip()
kind_set = set()
rates = list(map(int, input().strip().split(' ')))

def whatcolor(rate):
  if rate < 400:
    return 0
  elif rate < 800:
    return 1
  elif rate < 1200:
    return 2
  elif rate < 1600:
    return 3
  elif rate < 2000:
    return 4
  elif rate < 2400:
    return 5
  elif rate < 2800:
    return 6
  elif rate < 3200:
    return 7
  else:
    return 'free'
  
free_n = 0
for r in rates:
  color = whatcolor(r)
  if color == 'free':
    free_n += 1
  else:
    kind_set.add(color)

ans_min = max(1, len(kind_set))
ans_max = len(kind_set) + free_n
print(ans_min, ans_max)

Submission status: Accepted

Solution code:
from bisect import bisect_right

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

r = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
c = [0] * 9

for score in a:
	i = bisect_right(r, score)
	c[i] += 1

ans = 8 - c[:-1].count(0)

print(max(1, ans), ans + c[8])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = {}
for i in range(0, 13):
    B[i] = 0
for i in A:
    B[i//400] += 1
ansA = 0
ansB = 0
for i in range(0, 13):
    if i < 8:
        if B[i] > 0:
            ansA += 1
            ansB += 1
    else:
        if B[i] > 0:
            ansB += B[i]
if min(A) >= 3200:
    ansA += 1
print(ansA, ansB)

Submission status: Accepted

Solution code:
N = int(input())

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

C = [0] * 9

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

num = sum(C[0:8])

ans1 = str(max(num, 1))
ans2 = str( num + C[8])
print(ans1 + " " + ans2)

Submission status: Accepted

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

hai = 0
tya = 0
midori = 0
mizu = 0
ao = 0
ki = 0
daidai = 0
aka = 0
iro = 0

for i in range(n):
    if a[i] <= 399:
        hai = 1
    elif a[i] <= 799:
        tya = 1
    elif a[i] <= 1199:
        midori = 1
    elif a[i] <= 1599:
        mizu = 1
    elif a[i] <= 1999:
        ao = 1
    elif a[i] <= 2399:
        ki = 1
    elif a[i] <= 2799:
        daidai = 1
    elif a[i] <= 3199:
        aka = 1
    else:
        iro += 1
        
min_iro = hai+tya+midori+mizu+ao+ki+daidai+aka

print(max(min_iro,1),min_iro+iro)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc064/tasks/abc064_c
# C - Colorful Leaderboard

n = int(input().split()[0])
a_list = list(map(int, input().split()))

start, end = 0, 399
rate_dict = {}
rate_id = 0

while end < 3200:
    # 灰色が1-399ではなく0-399になるが
    # 影響はないので0-で実装
    data = dict(start=start, end=end)
    rate_dict[rate_id] = data
    rate_id += 1
    start += 400
    end += 400

count_dict = {rate_id: 0 for rate_id in rate_dict.keys()}

for a in a_list:
    for rate_id, v in rate_dict.items():
        if v['start'] <= a <= v['end']:
            count_dict[rate_id] += 1

count_over = n - sum(count_dict.values())
ALL_COLOR_N = len(count_dict.keys())  # 8色

# 0人の色数
zero_color_n = len([v for v in count_dict.values() if v == 0])

# 最小値
if count_over == n:
    # 全員オーバー
    min_n = 1
else:
    # すでに人がいる色に割り振れば良いので、色数は増えない
    min_n = ALL_COLOR_N - zero_color_n

# 最大値
# オーバーの人は、既存の8色以外も選べる
max_n = (ALL_COLOR_N - zero_color_n) + count_over

ans = ' '.join([str(min_n), str(max_n)])
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
a=map(int,input().split())
c=0
s=set()
for i in a:
    if i>=3200:
        c+=1
    else:
        s.add(i//400)
print(max(1,len(s)),len(s)+c)

Submission status: Accepted

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

ans = [0] * 8
free = 0

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

num = len(ans) - ans.count(0)
print(str(max(num, 1)) + ' ' + str(num + free))

Submission status: Accepted

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

c=[0,0,0,0,0,0,0,0]
cnt=0
for rate in rates:
  for i in range(8):
    if 400*i<=rate<400*(i+1):
      c[i]+=1
      break
  if rate>=3200:
    cnt+=1
    
ans=len(c)-c.count(0)
if ans==0:
  ans=1
print(min(n,ans),min(n,ans+cnt))

Submission status: Accepted

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

color=[0 for i in range(8)]
upper=0

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

lower=sum(color)
if lower==0:
    mn=1
    mx=upper
else:
    mn=lower
    mx=lower+upper
print(mn,mx)

Submission status: Accepted

Solution code:
from bisect import bisect_right

N = int(input())
A = [int(s) for s in input().split()]
r = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
c = [0] * 9
for a in A:
    i = bisect_right(r, a)
    c[i] += 1
ans = 8 - c[:-1].count(0)
print(max(1, ans), ans + c[8])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
thresholds = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
thresholds.reverse()

counts = [0 for _ in range(len(thresholds))]
for a_i in a:
    for i, threshold in enumerate(thresholds):
        if a_i >= threshold:
            counts[i] += 1
            break

sum = 0
for i in range(1, len(counts)):
    sum += 1 if counts[i] > 0 else 0
print("{} {}".format(max(1, sum), sum + counts[0]))

Submission status: Accepted

Solution code:
import sys
import bisect
input = sys.stdin.readline
 
def main():
    n=int(input())
    a = list(map(int,input().split()))
    s=[0, 0, 0, 0, 0, 0, 0, 0, 0]
    for i in range(n):
        if(a[i]>=3200):
            s[8]+=1
        else:
            s[(a[i]//400)]=1
    ans=0
    for i in range(8):
        ans+=s[i]
    M=ans+s[8]
    if(ans==0):
        ans=1
    print(ans,M)
    
    
main()

Submission status: Accepted

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

for a in A:
    k = a // 400
    if k < 8 and color[k] == 0:
        color[k] += 1
    elif k >= 8:
        e += 1

c = color.count(1)
y = e + c

if c == 0:
    x = 1
else:
    x = c

print(x, y)

Submission status: Accepted

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

    if all(a >=3200 for a in A):
        return 1, len(A)

    cls = set()
    count = 0
    for a in A:
        isAbove = True
        for i in range(8):
            if 400*i <= a < 400*(i+1):
                cls.add(i)
                isAbove = False
                break
        if isAbove:
            count += 1
    return len(cls), len(cls)+count

if __name__ == '__main__':
    output = main()
    print(" ".join(map(str, output)))

Submission status: Accepted

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(max(1,8-non_col),8-non_col+free)

if __name__ == "__main__":
    main()

Submission status: Accepted

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 = len(s)+ne
print(tmin, tmax)

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):
    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:
    if len(d) > 1:
        ans_min, ans_max = len(d)-1, len(d)-1+d[3200]
    else:
        ans_min, ans_max = 1, d[3200]
else:
    ans_min, ans_max = len(d), len(d)

print(ans_min, ans_max)

Submission status: Accepted

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=(cnt+free)
print(x,y)

Submission status: Accepted

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)), num_color-p[:-1].count(0)+p[-1])

Submission status: Accepted

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: Accepted

Solution code:
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

C = np.array([a // 400 for a in A])
C[C >= 8] = 8

ans = 0
for i in range(8):
    ans += np.any(C == i)
print(max(ans, 1), ans + (C == 8).sum())

Submission status: Accepted

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
ans_max = len(d) + len(B)
print(ans_min)
print(ans_max)

Submission status: Accepted

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 = max(1,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: Accepted

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,kind+overrate)
else:
    print(min(8,kind),kind+overrate)

Submission status: Accepted

Solution code:
n = int(input())
*l, = map(int,input().split())
pro = 0
amature = set()
for i in l:
  j = i//400
  if j >=8:
    pro+=1
  else:
    amature.add(j)
minans = max([1,len(amature)])
maxans = len(amature) + pro
print(minans, maxans)

Submission status: Accepted

Solution code:
n = int(input())
an = [int(x) for x in input().split()]
result = [0] * 8
colorful = 0
for a in an:
    if a >= 3200:
        colorful += 1
    else:
        result[a // 400] += 1
color = len([x for x in result if x > 0])
print(max(1, color), color + colorful)