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, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    a = f()

    b = [0] * 9
    for i in range(n):
        if a[i]<=399:
            b[0] += 1
        elif a[i]<=799:
            b[1] += 1
        elif a[i]<=1199:
            b[2] += 1
        elif a[i]<=1599:
            b[3] += 1
        elif a[i]<=1999:
            b[4] += 1
        elif a[i]<=2399:
            b[5] += 1
        elif a[i]<=2799:
            b[6] += 1
        elif a[i]<=3199:
            b[7] += 1
        else:
            b[8] += 1
    
    cnt = 0
    for i in range(8):
        if b[i] >0:
            cnt+=1

    minc = cnt if cnt>0 else 1

    maxc = cnt + b[8]
    print(minc, maxc)

solve()

Submission status: Accepted

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

Submission status: Accepted

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

color = [0] * 8
free = 0
for i in a:
    if i < 3200:
        color[i//400] += 1
    else:
        free += 1

# free = min(free, 8)

ans = 0
for i in color:
    if i > 0:
        ans += 1

if ans == 0:
    ans1 = 1
else:
    ans1 = ans
ans2 = ans + free

print(ans1, ans2)

Submission status: Accepted

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

s = 1
s = 399
ct = [0 for i in range(8)]
wild = 0

for i in a:
    idx = 0
    if i >= 3200:
        wild += 1
    else:
        for j in range(400, 3201, 400):
            if i < j:
                ct[idx] = 1
                break
            idx += 1

Min = max(1, sum(ct))
Max = wild + sum(ct)

print(Min, Max)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
topcoder = 0
colors = []
for i in a:
    if i > 3199:
        topcoder += 1
    else:
        colors.append(i//400)
minimum = 1 if len(colors) == 0 else len(list(set(colors)))
maximum = len(list(set(colors)))+topcoder
print('{} {}'.format(minimum,maximum))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict

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

counter = defaultdict(int)
for ai in a:
    counter[min(ai // 400, 8)] += 1
ans = 0
for i in range(8):
    if counter[i] > 0:
        ans += 1
if ans == 0:
    print(1, counter[8])
else:
    print(ans, ans + counter[8])

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
c = {n:0 for n in range(0, 9)}
for a_ in a:
    a__ = a_ // 400
    if a__ <= 7:
        c[a__] += 1
    else:
        c[8] += 1
count = 0
for k, v in c.items():
    if k <= 7:
        if v > 0:
            count += 1
    elif k == 8:
        cc = v + count
if count == 0:
    count = 1
ans = str(count) + " " + str(cc)
print(ans)

Submission status: Accepted

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

rate = {}

def color_check(n):
    if 1 <= n <= 399:
        return 'gray'
    elif 400 <= n <= 799:
        return 'brown'
    elif 800 <= n <= 1199:
        return 'green'
    elif 1200 <= n <= 1599:
        return 'lightblue'
    elif 1600 <= n <= 1999:
        return 'blue'
    elif 2000 <= n <= 2399:
        return 'yellow'
    elif 2400 <= n <= 2799:
        return 'orange'
    elif 2800 <= n <= 3199:
        return 'red'
    elif 3200 <= n:
        return 'top'

for n in a:
    col = color_check(n)
    rate.setdefault(col, 0)
    rate[col] += 1

colors = len(rate)

if not 'top' in rate:
    maxl, minl = colors, colors
else:
    maxl = (colors - 1) + rate['top']
    if colors == 1:
        minl = 1
    else:
        minl = (colors - 1)

print(minl, maxl)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
colors = set()
cnt = 0
for i in range(N):
    for j in range(1, 9):
        if (j - 1) * 400 <= A[i] < j * 400:
            colors.add(j)
            break
    if 3200 <= A[i]:
        cnt += 1

col_len = len(colors)
print(max(col_len, 1), col_len + cnt)

Submission status: Accepted

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

l = [0 for _ in range(8)]

b = 0

for i in range(N):
    if a[i] >= 3200:
        b += 1
    else:
        l[a[i] // 400] = 1

ans2 = sum(l) + b

ans1 = sum(l)
if ans1 == 0:
    ans1 = 1

print(ans1, ans2)

Submission status: Accepted

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

def mapColor(rate):
    if rate<=399:
        return 'grey'
    if rate<=799:
        return 'tea'
    if rate<=1199:
        return 'green'
    if rate<=1599:
        return 'water'
    if rate<=1999:
        return 'blue'
    if rate<=2399:
        return 'yellow'
    if rate<=2799:
        return 'orange'
    if rate<=3199:
        return 'red'
    return 'any'

s = set()

x = 0

for d in data:
    c = mapColor(d)
    if c=='any':
        x+=1
    else:
        s.add(c)

if len(s)!=0:
    print(len(s),end=" ")
else:
    print("1",end=" ")
print(x+len(s))

Submission status: Accepted

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

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

for i in range(0,8):
  if ans[i] > 0:
    minv += 1
    

maxv = str(minv + ans[8])
if minv == 0:
  minv = 1
minv = str(minv)


#print(ans)
print("".join([minv, " ", maxv]))

Submission status: Accepted

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    c_num = 8 # カラー数の上限
    c = [0]*c_num
    all_color = 0
    a = list(int(_) for _ in input().split())
    for i in range(len(a)):
        index = a[i]//400
        if(index < 8):
            c[index] = 1
        else:
            all_color +=1
    min_color = max(sum(c),1)

    # for i in range(len(c)):
    #     if(c[i]==0 and all_color>0):
    #         c[i] = 1
    #         all_color -=1
    max_color = sum(c) + all_color
    print(min_color,max_color)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
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 LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N=_I()
A=LI()
l = [0,0,0,0,0,0,0,0]
x=0
for a in A:
	if a <= 399:
		l[0]+=1
	elif a<= 799:
		l[1] += 1
	elif a <= 1199:
		l[2] += 1
	elif a <= 1599:
		l[3] += 1
	elif a <= 1999:
		l[4] += 1
	elif a<= 2399:
		l[5]+=1
	elif a<= 2799:
		l[6]+=1
	elif a<=3199:
		l[7]+=1
	else:
		x+=1
	
ans =sum(1 if i>0 else 0 for i in l)
if ans==0:
	print(1, end=" ")
else:
	print(ans,end=" ")

print(ans+x)

Submission status: Accepted

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

l = [0] * 9
p = 0
for i in range(0,n):
    q = a[i] // 400
    if q < 8:
        l[q] = 1
    else:
        l[8] = 1
        p = p + 1

s = sum(l[0:8])
m = max(s,l[8])
M = s+p
print(m,M)

Submission status: Accepted

Solution code:
N=int(input())
a=[int(i) for i in input().split()]
rates=[0]*9
for rate in a:
    rates[min(rate//400,8)]+=1
ans=0
for color in rates[:8]:
    ans+=(color!=0)
ansmax=ans+rates[8]
print(max(ans,1),ansmax)

Submission status: Accepted

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

rank_num = [0] *  9
for item in a:
    item_rank = -1 
    if item < 400:
        item_rank = 0
    elif item < 800:
        item_rank = 1
    elif item < 1200:
        item_rank = 2
    elif item < 1600:
        item_rank = 3
    elif item < 2000:
        item_rank = 4
    elif item < 2400:
        item_rank = 5
    elif item < 2800:
        item_rank = 6
    elif item < 3200:
        item_rank = 7
    else:
        item_rank = 8
    rank_num[item_rank] += 1

ans_min = max(8 - rank_num[:-1].count(0), 1)
ans_max = 8 - rank_num[:-1].count(0) + rank_num[-1]
print(ans_min, ans_max)

Submission status: Accepted

Solution code:
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n = ni()
a = nl()
l = [0 for _ in range(9)]
for i in range(n):
    if a[i] <= 399:
        l[0] += 1
    elif 400 <= a[i] <= 799:
        l[1] += 1
    elif 800 <= a[i] <= 1199:
        l[2] += 1
    elif 1200 <= a[i] <= 1599:
        l[3] += 1
    elif 1600 <= a[i] <= 1999:
        l[4] += 1
    elif 2000 <= a[i] <= 2399:
        l[5] += 1
    elif 2400 <= a[i] <= 2799:
        l[6] += 1
    elif 2800 <= a[i] <= 3199:
        l[7] += 1
    elif 3200 <= a[i]:
        l[8] += 1
if l[8] == 0:
    print(9 - l.count(0), 9 - l.count(0))
else:
    if l.count(0) == 8:
        print(1, l[8])
    else:
        print(8 - l.count(0), 8 - l.count(0) + l[8])

Submission status: Accepted

Solution code:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
import math
#n=int(input())
#li=input().split()
#S=input()

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

l=[0,0,0,0,0,0,0,0,0]

for i in range(n):
    a=math.floor(lis[i]/400)
    if a<8:
        l[a]=1
    else:
        l[-1]+=1

if sum(l[:8])==0:
    print(1,l[8])
else:
    print(sum(l[:8]),sum(l))

Submission status: Accepted

Solution code:
#13:27
N = int(input())
A = list(map(int,input().split()))
ex_red = [0]*8
red_cnt = 0

for i in range(8):#0-7
    for j in range(N):
        if 400*i<=A[j] and A[j]<400*(i+1):
            ex_red[i]+=1
n = 0
for i in range(N):
    if 3200 <= A[i]:
        n += 1
not_red_color = 0
c = 0
for i in range(8):
    if ex_red[i] > 0:
        c += 1
#print(c)#soreigai_count
#print(n)#red_count

max_ans = n + c

#min_ans
if c >= 1:
    min_ans = c
elif c == 0:
    min_ans = 1
print(min_ans, max_ans)

Submission status: Accepted

Solution code:
from collections import OrderedDict
import numpy as np

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

scores = OrderedDict()
scores[1] = 0
scores[400] = 0
scores[800] = 0
scores[1200] = 0
scores[1600] = 0
scores[2000] = 0
scores[2400] = 0
scores[2800] = 0
scores[3200] = 0

for record in a:
  for s in list(scores.keys())[::-1]:
    if record>=s:
      scores[s] += 1
      break
      
colors = np.sum([
  int(v>0) for k, v in scores.items() if k<3200])

if scores[3200]>0 and colors==0:
  min_colors = 1
else: 
  min_colors = colors
max_colors = colors + scores[3200]

print(min_colors, max_colors)

Submission status: Accepted

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

color_set = set()
original_cnt = 0
red_flag = False
for val in a:
    if val >= 3200:
        original_cnt += 1
    else:
        if val >= 2800:
            red_flag = True
        color_set.add(int(val / 400))
if red_flag is True:
    print('{} {}'.format(len(color_set), len(color_set) + original_cnt))
else:
    if original_cnt > 0:
        print('{} {}'.format(len(color_set) + 1, len(color_set) + original_cnt))
    else:
        print('{} {}'.format(len(color_set), len(color_set)))

Submission status: Accepted

Solution code:
n=int(input())
s = list(map(int,input().split()))
li=[0]*9
for i in range(n):
  if s[i]<3200:
    b=s[i]//400
    li[b]+=1
  else:
    li[8]+=1

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

c=ans+li[8]

if ans==0:
  print(1,c)
else:
  print(ans,c)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
l = [0]*8
red = 0
for i in range(n):
    if a[i]<=399:
        l[0]+=1
    elif a[i]<=799:
        l[1]+=1
    elif a[i]<=1199:
        l[2]+=1
    elif a[i]<=1599:
        l[3]+=1
    elif a[i]<=1999:
        l[4]+=1
    elif a[i]<=2399:
        l[5]+=1
    elif a[i]<=2799:
        l[6]+=1
    elif a[i]<=3199:
        l[7]+=1
    else:
        red+=1
k = 8-l.count(0)
if k>=1:
    print(k,red+k)
else:
    print(1,red+k)

Submission status: Accepted

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

for i in range(N):
  for j in range(9):
    if(j == 0):
      if(1<=A[i]<400): Color[j] = 1 
    elif(1<=j<=7):
       if(400*j<=A[i]<400*(j+1)):Color[j] = 1
    else:
       if(3200<=A[i]): Color[j] += 1
   

if(N == Color[-1]):
  ans_min = 1
  ans_max = N
else:
  ans_min = sum(Color) - Color[-1]
  ans_max = sum(Color) 
print(ans_min,ans_max)

Submission status: Accepted

Solution code:
import bisect
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
color_list = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
color_dict = defaultdict(int)
red_count = 0
for i in a:
  idx = bisect.bisect_right(color_list, i)
  if 1 <= idx <= 8:
    color_dict[idx] += 1
  elif idx == 9:
    red_count += 1
if len(color_dict) >= 1:
  print(len(color_dict), len(color_dict)+red_count)
else:
  print(1, red_count)

Submission status: Accepted

Solution code:
from sys import stdin

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

rate = [0]*8
f = 0

for i in range(n):
    if 3199 < a[i]:
        f += 1
    else:
        rate[int((a[i]/400))] = 1

s = sum(rate)
min = s if 0 < s else 1
max = s+f

print(min, max)

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    
    wildcard = 0
    color = [0] * 8
    for a in A:
        if a < 400:
            color[0] = 1
        elif a < 800:
            color[1] = 1
        elif a < 1200:
            color[2] = 1
        elif a < 1600:
            color[3] = 1
        elif a < 2000:
            color[4] = 1
        elif a < 2400:
            color[5] = 1
        elif a < 2800:
            color[6] = 1
        elif a < 3200:
            color[7] = 1
        else:
            wildcard += 1

    nc = sum(color)
    print(max(1, nc), nc + wildcard)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
x = {}
for i in range(n):
    t = min(a[i] // 400, 8)
    if t in x.keys():
        x[t] += 1
    else:
        x[t] = 1
m = 0
l = len(x.keys())
if 8 in x.keys():
    ans = [max(1, l - 1), l - 1 + x[8]]
else:
    ans = [l, l]
print(*ans)

Submission status: Accepted

Solution code:
c=[0]*8;n=int(input());a=list(map(int,input().split()))
r=0
for i in a:
  if i>3199:r+=1
  else:c[i//400]=1
b=c.count(1)
print(max(b,1),b+r)

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
color=[0]*9
for i in range(N):
    if a[i]//400>=8:
        color[8]+=1
    else:
        color[a[i]//400]+=1
cnt=0
for i in range(8):
    if color[i]>0:
        cnt+=1
mx=cnt+color[8]
if cnt>0:
    mn=cnt
else:
    mn=1
print(mn,mx)

Submission status: Accepted

Solution code:

from collections import Counter

N = int(input())
a = Counter(list(map(lambda x: x//400, map(int, input().split()))))

c = n = 0
for key in [0,1,2,3,4,5,6,7]:
    if a[key]:
        c += 1
        
for key in [8,9,10,11,12]:
    n += a[key]
        
max_n = c+n
if c:
    min_n = c
else:
    min_n = 1
print(min_n, max_n)

Submission status: Accepted

Solution code:
from collections import OrderedDict
N = int(input())
A = list(map(int, input().split()))
R = {"gray": 0, "brown": 0, "green": 0, "light": 0, "blue": 0, "yellow": 0, "orange": 0, "red": 0}
S = OrderedDict([("gray", 400), ("brown", 800), ("green", 1200), ("light", 1600), ("blue", 2000), ("yellow", 2400), ("orange", 2800), ("red", 3200)])
for a in A:
    for r, s in S.items():
        if a < s:
            R[r] += 1
            break
num = len([r for r, n in R.items() if n != 0])
other = N - sum([n for r, n in R.items() if n != 0])
if num == 0:
    print(1, N)
    exit()
print(num, num + other)

Submission status: Accepted

Solution code:
N = int(input())
R = list(map(int,input().split()))
a = [0]*8
b = 0
for i in range(N):
    if R[i] < 400:
        a[0] += 1
    elif R[i] < 800:
        a[1] += 1
    elif R[i] < 1200:
        a[2] += 1
    elif R[i] < 1600:
        a[3] += 1
    elif R[i] < 2000:
        a[4] += 1
    elif R[i] < 2400:
        a[5] += 1
    elif R[i] < 2800:
        a[6] += 1
    elif R[i] < 3200:
        a[7] += 1
    else:
        b += 1
ans = 0
for i in range(8):
    if a[i] != 0:
        ans += 1
ans2 =str(ans+b)
if ans == 0:
    ans = 1
ans1 = str(ans)
print(ans1+" "+ans2)

Submission status: Accepted

Solution code:
v = [0]*9
n = int(input())
a = list(map(int,input().split()))
for i in a:
  idx = i//400
  if idx >= 8: idx = 8
  v[idx] += 1
r = 0
for i in range(8):
  if v[i] >= 1: r+= 1
print(max(1,r), r+v[8])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
color =set()
t = 0
for i in range(n):
    if a[i] <=399:
        a[i] = "gray"
    elif a[i]<= 799:
        a[i] = "brown"
    elif a[i]<=1199:
        a[i] = "green"
    elif a[i] <= 1599:
        a[i] = "water"
    elif a[i] <= 1999:
        a[i] ="blue"
    elif a[i] <=2399:
        a[i] ="yellow"
    elif a[i] <=2799:
        a[i] ="daidai"
    elif a[i] <= 3199:
        a[i] = "red"
    else:
        a[i] = "target"
        t += 1
for i in range(n):
    if a[i] != "target":
       color.add(a[i])
    else:
        continue
if len(list(color)) >=1:
    print(len(list(color)),len(list(color))+t)
else:
    print(1,t)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
A2 = list(map(lambda a: a // 400, A))

G1 = [a for a in A2 if a < 8]
min = len(set(G1))
max = min + len(A2) - len(G1)

if min == 0:
    min = 1
print(min, max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
c = [0] * 8
f = 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:
        f += 1
print(max(8 - c.count(0), 1), 8 - c.count(0) + f)

Submission status: Accepted

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

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
    elif 3200 <= a[i]:
        color[8] += 1


min_col = color[:]
min_cnt = 0
del min_col[-1]
for i in range(len(min_col)):
    if min_col[i] != 0:
        min_cnt += 1

max_cnt = min_cnt + color[8]
min_cnt = max(1,min_cnt)

print(min_cnt, max_cnt)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
dic, c = {}, 0
for i in range(N):
    b = min(a[i] // 400, 8)
    if b not in dic:
        dic[b] = 1
    if b == 8:
        c += 1
m, M = len(dic.keys()), len(dic.keys())
if c > 0:
    m = max(1, m - 1)
    M += c - 1
print(m, M)

Submission status: Accepted

Solution code:
N = int(input())
alist = list(map(int,input().split()))
gray , brown ,green , sky , blue , yellow , orange  ,red , top = 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
for a in alist:
    if a < 400:
        gray += 1
    elif a < 800:
        brown += 1
    elif a < 1200:
        green += 1
    elif a < 1600:
        sky += 1
    elif a < 2000:
        blue += 1
    elif a < 2400:    
        yellow += 1
    elif a < 2800:  
        orange += 1
    elif a < 3200:
        red += 1
    else:
        top += 1  
cmin = 0
cmax = 0
if  gray > 0:
    cmin += 1
    cmax += 1
if  brown > 0:
    cmin += 1
    cmax += 1
if  green > 0:
    cmin += 1
    cmax += 1
if  sky > 0:
    cmin += 1
    cmax += 1
if  blue > 0:
    cmin += 1
    cmax += 1
if  yellow > 0:
    cmin += 1
    cmax += 1
if  orange > 0:
    cmin += 1
    cmax += 1
if  red > 0:
    cmin += 1
    cmax += 1
if  top > 0:
    if cmin == 0:
        cmin += 1
    cmax += top
print(cmin ,cmax)

Submission status: Accepted

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

for a in A:
  cls=min(a//400, 8)
  #print(a, cls)
  if cls>=8:
    counter[8]+=1
  else:
    counter[cls]=1
#print(counter)

#min
print(max(1, sum(counter[0:8])), (sum(counter[0:8])+counter[8]))

Submission status: Accepted

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
ls = [0]*9
b = [1,400,800,1200,1600,2000,2400,2800,3200,4810]
for i in range(N):
    for j, (x, y) in enumerate(zip(b, b[1:])):
        if x <= a[i] and a[i] < y:
            ls[j] += 1
l = 8 - ls[:-1].count(0)
if l == 0:
    print(1, ls[-1])
else:
    print(l, l+ls[-1])

Submission status: Accepted

Solution code:
input()
rates = [int(x) for x in input().split(' ')]

colors = set()

for rate in rates:
    if rate in range(1, 400):
        colors.add('gray')
    elif rate in range(800):
        colors.add('brown')
    elif rate in range(1200):
        colors.add('green')
    elif rate in range(1600):
        colors.add('lightblue')
    elif rate in range(2000):
        colors.add('blue')
    elif rate in range(2400):
        colors.add('yellow')
    elif rate in range(2800):
        colors.add('orange')
    elif rate in range(3200):
        colors.add('red')

print(max(len(colors), 1), len(colors) + len([x for x in rates if x >= 3200]))

Submission status: Accepted

Solution code:
def colorful_leaderboard(N: int, A: list)->tuple:
    rates = {
        '0001-0399': False,
        '0400-0799': False,
        '0800-1199': False,
        '1200-1599': False,
        '1600-1999': False,
        '2000-2399': False,
        '2400-2799': False,
        '2800-3199': False,
    }
    wildcard = 0

    for a in A:
        if a < 400:
            rates['0001-0399'] = True
        elif a < 800:
            rates['0400-0799'] = True
        elif a < 1200:
            rates['0800-1199'] = True
        elif a < 1600:
            rates['1200-1599'] = True
        elif a < 2000:
            rates['1600-1999'] = True
        elif a < 2400:
            rates['2000-2399'] = True
        elif a < 2800:
            rates['2400-2799'] = True
        elif a < 3200:
            rates['2800-3299'] = True
        else:
            wildcard += 1

    rated_colors = sum(rates.values())
    return rated_colors if rated_colors > 0 else 1, rated_colors + wildcard


if __name__ == "__main__":
    N = int(input())
    A = [int(s) for s in input().split()]
    min_c, max_c = colorful_leaderboard(N, A)
    print(min_c, max_c)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
a_list = list(map(int, input().split()))
class_list = []
free_list = []
for a in a_list:  
  if a < 3200:
    amod = a // 400
    class_list.append(amod)
  
  else:
    free_list.append(a)

set_list = list(set(class_list))
min_list = len(set_list)
max_list = len(set_list) + len(free_list)

if min_list == 0:
  min_list = 1
print(min_list, max_list)

Submission status: Accepted

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

array1 = [0] * 8
over3200 = 0

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

ansmax = A + over3200
ansmin = max(A, 1)
    
print(ansmin, ansmax)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
tourist = 0
human = [0 for i in range(8)]
for i in range(N):
    if a[i] >= 3200:
        tourist += 1
        continue
    else: human[a[i]//400] += 1
color = sum([1 for i in human if i > 0])
print(str(max(1,color))+' '+str(color+tourist))

Submission status: Accepted

Solution code:
from collections import Counter
input()
a = [x // 400 for x in map(int, input().split())]
c = []
ans = 0
for i in a:
    if i > 7:
        ans += 1
    else:
        c.append(i)
print(max(1,len(Counter(c))), ans + len(Counter(c)))

Submission status: Accepted

Solution code:
n=int(input())

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

C=[0]*9

for i in A:
    x=i//400
    if x<8:
        C[x]=1
    else:
        C[8]+=1
b=sum(C[:8])
print(str(max(b,1))+' '+str(b+C[8]))

Submission status: Accepted

Solution code:
n=int(input())

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

ov=0
res=0
C=[0]*8

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

for j in C:
    if j!=0:
        res+=1
if res!=0:
    print(str(res)+' '+str(res+ov))
else:
    print(str(1)+' '+str(ov))

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split(' ')))
colors=[8 if a>=3200 else a//400 for a in A]
c1=[1 if i in colors else 0 for i in range(8)]
c2=colors.count(8)
print(max(1,c1.count(1)),c1.count(1)+c2)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
rate=[0]*10;cnt=0
lena=[0]*10
for i in range(n):
    if 1<=a[i]<=399:
        rate[0]=1
        lena[0]=1
    elif 400<=a[i]<=799:
        rate[1]=1
        lena[1]=1
    elif 800<=a[i]<=1199:
        rate[2]=1
        lena[2]=1
    elif 1200<=a[i]<=1599:
        rate[3]=1
        lena[3]=1
    elif 1600<=a[i]<=1999:
        rate[4]=1
        lena[4]=1
    elif 2000<=a[i]<=2399:
        rate[5]=1
        lena[5]=1
    elif 2400<=a[i]<=2799:
        rate[6]=1
        lena[6]=1
    elif 2800<=a[i]<=3199:
        rate[7]=1
        lena[7]=1
    else:
        cnt+=1
m=sum(rate)
if m==0:
    m=1
    print(m,cnt)
else:
    print(m,m+cnt)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
A=list(map(lambda x:x//400 if x//400<=7 else 8 ,A))
target=A.count(8)
total=len(set(A))
min=total-1 if 8 in A else total
print(min if min!=0 else 1,min+target)