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_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	n = int(input())
	bb=[0]*8
	free=0
	al=list(IN())
	for rate in al:
		#rate = int(input())
		cc = rate // 400
		if cc < 8:
			bb[cc]+=1
		else:
			free+=1
	ccc=0
	for b in bb:
		ccc += b>0
	min_n = max(1,ccc)
	max_n = ccc + free
	print(min_n, max_n)
				
	#b , c = IN()
	#s = input()
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
#ABC064-C
n = int(input())
a = list(map(int,input().split()))
ma = 0
mi = 0
color = [False for _ in range(8)]

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

ma = red + c
        
if c == 0:
    mi = 1
else:
    mi = c
    

print(mi,ma)

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int,input().split()))
color = [0]*8
x = 0

for i in li:
    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:
        x += 1

ans = 8-color.count(0)
x += ans
if ans == 0:
    ans += 1
print(ans, x)

Submission status: Accepted

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

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

count = 0
for b in B[:8]:
    if b:
        count += 1

print(max(count, 1), count + B[8])

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
arrA = np.array(input().split(),dtype=np.int64)
bins = np.array([400,800,1200,1600,2000,2400,2800,3200,4801])
arr = np.digitize(arrA,bins)
ans = np.bincount(arr,minlength=9)
ans1 = len(ans[:-1][ans[:-1]>0])
ans2 = ans1 + ans[-1]
if ans1 == 0:
    ans1 = 1
print(ans1,ans2)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    a=list(map(int,input().split()))
    l=[0]*8
    red=0
    for i in range(N):
        if a[i]<3200:
            l[a[i]//400]=1
        else:
            red+=1
    if sum(l)>=1:
        print(sum(l),sum(l)+red)
    else:
        print(1,sum(l)+red)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict

n = int(input())
a = list(map(int, input().split()))
ans = 0
cnt_free = sum(x >= 3200 for x in a)
for i in range(8):
    if sum(x >= 400 * i and x < 400 * (i + 1) for x in a) >= 1:
        ans += 1
print(max(1, ans))
print(ans + cnt_free)

Submission status: Accepted

Solution code:
def myAnswer(N:int,A:list) -> int:
   counter = 0
   free = 0
   rate = [0 for _ in range(8)]
   for a in A:
      if(a <= 399):
         rate[0] += 1
      elif(a <= 799):
         rate [1] += 1
      elif(a <= 1199):
         rate[2] += 1
      elif(a <= 1599):
         rate[3] += 1
      elif(a <= 1999):
         rate[4] += 1
      elif(a <= 2399):
         rate[5] += 1
      elif(a <= 2799):
         rate[6] += 1
      elif(a <= 3199):
         rate[7] += 1
      else:
         free += 1
   for r in rate:
      if(r > 0):
         counter += 1
   if(free == N):
      print(1,free)
   else:
      print(counter,counter+free)


def modelAnswer():
   return
def main():
   N = int(input())
   A = list(map(int,input().split()))
   myAnswer(N,A[:])
if __name__ == '__main__':
   main()

Submission status: Accepted

Solution code:
def GetColor(point):
   color = point//400
   if color>=8:
      color = -1
   return color

N = int(input())
A = map(int,input().split())
Nc = [0 for i in range(9)]
for ai in A:
   Nc[GetColor(ai)]+=1

Nf = Nc[-1]
Ans = 0
for ic in range(len(Nc)-1):
   if Nc[ic]>0:
      Ans+=1
# maxNc = min(Ans+Nf, 8)
maxNc = Ans+Nf
minNc = max(1,Ans)
print("%d %d"%(minNc,maxNc))

Submission status: Accepted

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

b = [0]*9
ans = 0
count = 0
for i in a:
    if i//400 < 8:
        b[i//400] = 1
    else:
        b[8] += 1
print(max(1, sum(b[:8])), sum(b))

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = iil()

l = [0]*9
for i in A:
    l[min(i//400,8)] += 1

lf = l[:-1]
ans = 8-lf.count(0)
print(max(1,ans),ans+l[8])

Submission status: Accepted

Solution code:
import math
l = input().split()
N = int(l[0])
l = input().split()
A = [0] * 13
for i in l:
    index = int(i) // 400
    if index < 8:
        A[index] = 1
    else:
        A[index] += 1
x = sum(A[:8])
y = sum(A[8:])

print(max(1, x), x + y)

Submission status: Accepted

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

def main():
    N = int(readline())
    A = list(map(int, readline().rstrip().split()))
    m = [a//400 for a in A if a < 3200]

    mi = len(set(m))
    ma = len(set(m)) + (N - len(m))
    print(max(1, mi), ma)    


if __name__ == '__main__':
    main()

Submission status: Accepted

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

def main():
    N = int(readline())
    A = list(map(int, readline().rstrip().split()))
    cnt = {k: 0 for k in ['gray', 'brown', 'green', 'light_blue', 'blue', 'yellow', 'orange', 'red', 'free']}
    for a in A:
        if a < 400:
            cnt['gray'] += 1
        elif a < 800:
            cnt['brown'] += 1
        elif a < 1200:
            cnt['green'] += 1
        elif a < 1600:
            cnt['light_blue'] += 1
        elif a < 2000:
            cnt['blue'] += 1
        elif a < 2400:
            cnt['yellow'] += 1
        elif a < 2800:
            cnt['orange'] += 1
        elif a < 3200:
            cnt['red'] += 1
        else:
            cnt['free'] += 1

    mi = 0
    for k, v in zip(cnt.keys(), cnt.values()):
        if k == 'free':
            continue
        if v:
            mi += 1
    ma = mi + cnt['free']
    print(max(1, mi), ma)    


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
c = [0] * 8
s = 0
for i in a:
    if i >= 3200:
        s += 1
    else:
        c[i // 400] = 1
sum_c = sum(c)
if sum_c:
    print('{} {}'.format(sum_c, sum_c + s))
else:
    print('{} {}'.format(min(1, s), s))

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    最小値が0にはならないので1 or 計算結果にするとところが味噌
    上記を忘れていると全ての値が3200を超えていた時にバグる
    '''
    import collections

    N = int(input())
    A_list = [int(item)//400 for item in input().split()]

    cnt_dict = collections.Counter(A_list)

    res_low = 0
    res_high = 0
    for i in range(4800//400 + 1):
        if i <= 7:
            if cnt_dict[i] >= 1:
                res_low += 1
        else:
            res_high += cnt_dict[i]

    print(max(res_low, 1), res_low + res_high)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

boundary = []
for i in range(8):
    boundary.append(400*(i+1))

colors = set()
free_choice = 0
for i in range(n):
    if a_l[i] < boundary[0]:
        colors.add('gray')
    elif boundary[0] <= a_l[i] < boundary[1]:
        colors.add('brown')
    elif boundary[1] <= a_l[i] < boundary[2]:
        colors.add('green')
    elif boundary[2] <= a_l[i] < boundary[3]:
        colors.add('lblue')
    elif boundary[3] <= a_l[i] < boundary[4]:
        colors.add('blue')
    elif boundary[4] <= a_l[i] < boundary[5]:
        colors.add('yellow')
    elif boundary[5] <= a_l[i] < boundary[6]:
        colors.add('orange')
    elif boundary[6] <= a_l[i] < boundary[7]:
        colors.add('red')
    else:
        free_choice += 1

ans = len(colors)
print(max(1,ans), ans+free_choice)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
l=[False]*8+[0]
for i in a:
    if i<400:
        l[0]=True
    elif i<800:
        l[1]=True
    elif i<1200:
        l[2]=True
    elif i<1600:
        l[3]=True
    elif i<2000:
        l[4]=True
    elif i<2400:
        l[5]=True
    elif i<2800:
        l[6]=True
    elif i<3200:
        l[7]=True
    else:
        l[8]+=1
print(max(sum(l[:8]),1),sum(l[:8])+l[8])#https://yukicoder.me/run/08454c2883ca1

Submission status: Accepted

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

Submission status: Accepted

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

c = [0 for _ in range(9)]
for ai in a:
  for i in range(8):
    if ai <= i*400+399:
      c[i] += 1
      break
  if ai >= 3200:
    c[8] += 1
mn = 0
for i in range(8):
  if c[i] > 0:
    mn += 1
mx = mn+c[8]
if mn == 0:
  mn = 1
print(mn,mx)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
normal = set()
choku = 0

for i in range(N):
  if a[i] // 400  >= 8:
    choku += 1
  else:
    normal.add(a[i]//400)
    
if len(normal) == 0:
  print(1, choku)
else:
  print(len(normal), len(normal)+choku)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
r=set()
r2=0

for i in a:
    if i>=3200:
        r2+=1
    else:
        r.add(i//400)

if len(r)==0:
    mi=1
else:
    mi=len(r)

ma=len(r)+r2

print(mi,ma)

Submission status: Accepted

Solution code:
import sys
import io

input = sys.stdin.readline
data = int(input())
array = [int(x) for x in input().split()]

color = set()
over = 0
for a in array :
    if a < 3200 :
        color.add(a//400)
    else :
        over += 1

print(max(1,len(color)), len(color)+over)

Submission status: Accepted

Solution code:
def main():
  N = int(input())
  A = [int(_)//400 for _ in input().split()]
  U = [a for a in A if a < 8]
  O = N - len(U)
  print(max(1, len(set(U))), len(set(U)) + O)
  return

if __name__ == '__main__':
  main()

Submission status: Accepted

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

dict = {}
ans = 0
count = 0
for i in range(N):
    if not( a[i]//400 in dict.keys() ):
        dict[a[i]//400] = 1
    else:
        dict[a[i]//400] += 1
for key in dict.keys():
    if key < 8:
        ans += 1
    else:
        count += dict[key]
if ans == 0:
    print(1, count)
else:
    print(ans, ans+count)

Submission status: Accepted

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

d = defaultdict(int)
a = 0
for num in nums:
    if 1 <= num <= 399:
        d['ash'] += 1
    elif 400 <= num <= 799:
        d['brown'] += 1
    elif 800 <= num <= 1199:
        d['green'] += 1
    elif 1200 <= num <= 1599:
        d['water'] += 1
    elif 1600 <= num <= 1999:
        d['blue'] += 1
    elif 2000 <= num <= 2399:
        d['yellow'] += 1
    elif 2400 <= num <= 2799:
        d['orange'] += 1
    elif 2800 <= num <= 3199:
        d['red'] += 1
    else:
        a += 1
MIN = len(d)
if MIN == 0 and a > 0:
    MIN = 1
MAX = len(d) + a
print(MIN, MAX)

Submission status: Accepted

Solution code:
# =map(int,input().split())
n=int(input())
a=list(map(int,input().split()))
ans=[0 for _ in range(8)]
cnt=0
res=0
for i in a:
    if 0<i<400:
        ans[0]+=1
    elif 400<=i<800:
        ans[1]+=1
    elif 800<=i<1200:
        ans[2]+=1
    elif 1200<=i<1600:
        ans[3]+=1
    elif 1600<=i<2000:
        ans[4]+=1
    elif 2000<=i<2400:
        ans[5]+=1
    elif 2400<=i<2800:
        ans[6]+=1
    elif 2800<=i<3200:
        ans[7]+=1
    elif 3200<=i:
        cnt+=1
for i in ans:
    if i==0:
        res+=1
x=8-res
# if x+cnt<9:
#     y=cnt+x
# else:
#     y=8
y=cnt+x
if x==0:
    x=1
print(x,y)
# print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
def main():
    N = int(input())
    p = [int(a) for a in input().split()]
    rate = defaultdict(int)
    for i in range(N):
        score = p[i]
        if 1 <= score <= 399:
            rate["GRAY"] += 1
        elif 400  <= score <= 799:
            rate["BROWN"] += 1
        elif 800  <= score <= 1199:
            rate["GREEN"] += 1
        elif 1200 <= score <= 1599:
            rate["LBLUE"] += 1
        elif 1600 <= score <= 1999:
            rate["BLUE"] += 1
        elif 2000 <= score <= 2399:
            rate["YELLOW"] += 1
        elif 2400 <= score <= 2799:
            rate["ORANGE"] += 1
        elif 2800 <= score <= 3199:
            rate["RED"] += 1
        elif 3200 <= score:
            rate["FREE"] += 1
    color = 0
    free  = 0
    for k, v in rate.items():
        if k != "FREE":
            if rate[k] > 0:
                color += 1
        else:
            free += rate[k]
    if color == 0 and free != 0:
        print(1, free)
    else:
        print(color , color + free)
main()

Submission status: Accepted

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

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

Submission status: Accepted

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

n=int(input())
a=list(map(int, input().split()))
a.sort()
d=[0 for _ in range(8)]

flg=False
minim=-1
for i in range(n):
    if a[i]<400:
        d[0]=1
    elif a[i]<800:
        d[1]=1
    elif a[i]<1200:
        d[2]=1
    elif a[i]<1600:
        d[3]=1
    elif a[i]<2000:
        d[4]=1
    elif a[i]<2400:
        d[5]=1
    elif a[i]<2800:
        d[6]=1
    elif a[i]<3200:
        d[7]=1
    else:
        if flg==False:
            minim=sum(d)
            flg=True
        d[0]+=1

if minim==-1:
    minim=sum(d)
elif minim==0:
    minim=1
print(minim,end=' ')
print(sum(d))

Submission status: Accepted

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

ans = [0]*8
free = 0
for a in A:
    for i in range(8):
        if a < (i+1)*400:
            ans[i]=1
            break
    if 3200 <= a:
        free += 1
ans_max = sum(ans)+free
ans_min = max(1, sum(ans))
print(ans_min, ans_max, sep=' ')

Submission status: Accepted

Solution code:
n, *A = map(int, open(0).read().split())
B = [0] * 9
for a in A:
  if a < 3200:
  	B[a // 400] = 1
  else:
    B[8] += 1
print(max(sum(B[:8]), 1), sum(B))

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
r=[0]*9
for a in A:
  for i in range(8,-1,-1):
    if a >= 400*i:
      r[i]+=1
      break
ans=0
for i in range(8):
  if r[i]>0: ans+=1
if ans==0: print(1, r[8])
else: print(ans, ans+r[8])

Submission status: Accepted

Solution code:
import collections

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

B = []
cnt = 0
for i in range(N):
    if A[i] >= 3200:
        cnt += 1
    else:
        B.append(A[i]//400)

c = collections.Counter(B)

small = len(c) if len(c) != 0 else 1
big = len(c)+cnt

print(small, big)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int,input().split(' ')))
rate = [0]*9
for a in A:
    c = min(a//400, 8)
    rate[c] += 1
count = 0
i = 0
while i < 8:
    if rate[i] != 0:
        count += 1
    i += 1
cmax = count+rate[8]
cmin = max(1, count)

print(str(cmin)+' '+str(cmax))

Submission status: Accepted

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

Submission status: Accepted

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

gray = 0
brown = 0
green = 0
lightblue = 0
blue = 0
yellow = 0
orange = 0
red = 0
other = 0

for rate in a:
    if 1 <= rate <= 399:
        gray += 1
    elif 400 <= rate <= 799:
        brown += 1
    elif 800 <= rate <= 1199:
        green += 1
    elif 1200 <= rate <= 1599:
        lightblue += 1
    elif 1600 <= rate <= 1999:
        blue += 1
    elif 2000 <= rate <= 2399:
        yellow += 1
    elif 2400 <= rate <= 2799:
        orange += 1
    elif 2800 <= rate <= 3199:
        red += 1
    else:
        other += 1

s = [gray, brown, green, lightblue, blue, yellow, orange, red]
s = list(filter(lambda x: x > 0, s))

cnt = len(s)

cnt1 = max(1, cnt)

print('{} {}'.format(cnt1,  cnt+other))

Submission status: Accepted

Solution code:
N=int(input()); A=list(map(int,input().split()))
L=[[1,399],[400,799],[800,1199],[1200,1599],[1600,1999],[2000,2399],[2400,2799],[2800,3199],[3200,4800]]
S=[0]*9;cnt=0;cnt1=0
for i in range(N):
  for j in range(9):
    if L[j][0]<=A[i]<=L[j][1]:
      S[j]=S[j]+1
for i in range(8):
  if S[i]!=0:
    cnt=cnt+1
cnt1=max(1,cnt)
print(cnt1,cnt+S[-1])

Submission status: Accepted

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

ans = 0
color = [False] * 8
free = 0
for n in a:
    if n < 400:
        color[0] = True
    elif n < 800:
        color[1] = True
    elif n < 1200:
        color[2] = True
    elif n < 1600:
        color[3] = True
    elif n < 2000:
        color[4] = True
    elif n < 2400:
        color[5] = True
    elif n < 2800:
        color[6] = True
    elif n < 3200:
        color[7] = True
    else:
        free += 1

colors = len([i for i in color if i])
mini = max(1, colors)
maxi = colors + free
print(mini, maxi)

Submission status: Accepted

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

colors = set()
other = 0
for num in list_A:
    num //= 400
    if num > 7:
        other += 1
    else:
        colors.add(num)

max_value = len(colors) + other
min_value = len(colors)

if len(colors) == 0:
    min_value = 1

print(min_value, max_value)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[0 for i in range(15)]
for some in a:
    b[some//400]+=1
ans=0
for i in range(8):
    if b[i]>0:
        ans+=1
mini=ans
for i in range(8,15):
    ans+=b[i]
if mini==0:
    mini=1
print(mini,ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
col1 = []
col2 = []
for i in a:
    if i//400<8:
        col1.append(i//400)
    else:
        col2.append(i//400)
min = len(set(col1))
if min == 0:
    min = 1
max = len(set(col1))+len(col2)

print(min, max)

Submission status: Accepted

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

cou = 0
for i in range(8):
    if p[i] == 1:
        cou += 1

if cou != 0:
    print(str(cou) + " " + str(cou + p[8]))
elif cou == 0:
    print(str(1) + " " + str(p[8]))

Submission status: Accepted

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

c = []
xn = 0
TF = [False for _ in range(8)]
for r in a:
    if r <= 399:
        TF[0] = True
    elif 400 <= r <= 799:
        TF[1] = True
    elif 800 <= r <= 1199:
        TF[2] = True
    elif 1200 <= r <= 1599:
        TF[3] = True
    elif 1600 <= r <= 1999:
        TF[4] = True
    elif 2000 <= r <= 2399:
        TF[5] = True
    elif 2400 <= r <= 2799:
        TF[6] = True
    elif 2800 <= r <= 3199:
        TF[7] = True
    else:
        xn += 1
truenum = sum(1 for i in TF if i)
minv = truenum
if truenum == 0:
    minv = 1
maxv = truenum + xn
print(minv, maxv)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(lambda x:min(int(x)//400,8),input().split()))
cat=[0]*8
f=0
for ai in a:
    if ai < 8:
        cat[ai]=1
    if ai == 8:
        f+=1
print(str(max(sum(cat),1))+' '+str(sum(cat)+f))

Submission status: Accepted

Solution code:
n=int(input())
a=list((map(int,input().split())))
l=[0 for _ in range(8)]
f=0
for i in range(n):
    r=a[i]//400
    if r<8:
        l[r]+=1
    else:
        f+=1
amin=0

for i in range(len(l)):
    if l[i]>=1:
        amin+=1
        
print(max(1,amin),amin+f)

Submission status: Accepted

Solution code:
# coding: utf-8
L = [0 for _ in range(8)]
N = int(input())
A = list(map(int, input().split()))
v = 0
for i in range(N):
    idx = A[i] // 400
    if idx >= 8:
        v += 1
    else:
        L[idx] += 1
amin, amax = 0, 0
for i in range(len(L)):
    if L[i] > 0:
        amin += 1
    # if L[i] == 0 and v > 0:
    #     L[i] += 1
    #     v -= 1
# amin = max(1, amin)
# for i in range(len(L)):
#     if L[i] > 0:
#         amax += 1
print(max(1, amin), amin + v)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
a=list(map(int,input().split()))
p=set()
s=0
for i in range(len(a)):
    if a[i]<3200:
        p.add(a[i]//400)
    else:
        s+=1
print(max(len(p),1), len(p)+s)

Submission status: Accepted

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

rates = set()
cnt = 0
for a in A:
    if (a < 400):
        rates.add(0)
    elif (400 <= a and a < 800):
        rates.add(1)
    elif (800 <= a and a < 1200):
        rates.add(2)
    elif (1200 <= a and a < 1600):
        rates.add(3)
    elif (1600 <= a and a < 2000):
        rates.add(4)
    elif (2000 <= a and a < 2400):
        rates.add(5)
    elif (2400 <= a and a < 2800):
        rates.add(6)
    elif (2800 <= a and a < 3200):
        rates.add(7)
    else:
        cnt += 1

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
red = 0
ans = 0
cnt = [0]*10
for x in a:
    if x < 3200:
        cnt[x//400] +=1
    else:
        red+=1
for x in cnt:
    if x >0:ans+=1

if red == n:print(1)
else:print(ans)
ans+=red
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
o=0
x=[]
for i in range(n):
  if a[i]>=3200:
    o+=1
  else:
    x.append(a[i]//400)
p=len(set(x))
q=max(1,p)
print(q,o+p)

Submission status: Accepted

Solution code:
import sys

n, *a = map(int, sys.stdin.read().split())

def main():
  cnt = [0] * 9
  for x in a:
    cnt[min(x, 3200) // 400] += 1
  mi = 0
  for x in cnt[:8]: 
    if x: mi += 1
  ma = mi + cnt[8]
  mi = max(1, mi)
  print(mi, ma)
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
# abc064_c.py
def _min(rates):
    return max(len(rates)-rates.count(0),1)

def _max(rates,free):
    return min(len(rates)-rates.count(0)+free,n)

n = int(input())
a = list(map(int,input().split()))
rates = [0]*8
free = 0
for i in a:
    if i<400: #gray
        rates[0] += 1
    elif i<800: #cha
        rates[1] += 1
    elif i<1200: #green
        rates[2] += 1
    elif i<1600: #water
        rates[3] += 1
    elif i<2000: #blue
        rates[4] += 1
    elif i<2400: #yellow
        rates[5] += 1
    elif i<2800: #daidai
        rates[6] += 1
    elif i<3200: #red
        rates[7] += 1
    else:
        free += 1
print(_min(rates),_max(rates,free))

Submission status: Accepted

Solution code:
n, *a = map(int, open(0).read().split())

def get_color(rate):
    if 1<=rate<400:
        return 'gray'
    elif rate<800:
        return 'brown'
    elif rate<1200:
        return 'green'
    elif rate<1600:
        return 'rb'
    elif rate<2000:
        return 'blue'
    elif rate<2400:
        return 'yellow'
    elif rate<2800:
        return 'orange'
    elif rate<3200:
        return 'red'
    else:
        return 'free'

c = set()
free_cnt = 0
for i in range(n):
    if get_color(a[i]) == 'free':
        free_cnt += 1
    else:
        c.add(get_color(a[i]))

min_ans = max(len(c),1)
max_ans = len(c)+free_cnt

print(min_ans, max_ans)

Submission status: Accepted

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

color = [False] * 9
i = rate[0] // 400
switch = 400 * (i + 1)

for r in range(len(rate)):
    if rate[r] < switch and i <= 7:
        color[i] = True
        if i == 8:
            color[8] += 1
    else:
        i = rate[r] // 400
        if i <= 7:
            color[i] = True
            switch = 400 * (i + 1)
        else:
            color[8] += 1

ans_min = sum(color[:8])
ans_max = sum(color)

if ans_min == 0:
    print("{} {}".format(1, ans_max))
else:
    print("{} {}".format(ans_min, ans_max))

Submission status: Accepted

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

def color(r):
    return min(r // 400, 8)

c = list(map(color, a))
cs = set(c)
cc = len(cs)
ac = c.count(8)
if ac == 0:
    print(cc, cc)
else:
    cc -= 1
    print(max(1,cc), cc+ac)

Submission status: Accepted

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

zero = num[:8].count(0)
print(max(8-zero,1), end = ' ')
print(8-zero + num[8])