Problem:


Score : 300 points

Problem Statement

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

Rating 1-399 : gray

Rating 400-799 : brown

Rating 800-1199 : green

Rating 1200-1599 : cyan

Rating 1600-1999 : blue

Rating 2000-2399 : yellow

Rating 2400-2799 : orange

Rating 2800-3199 : red

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

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

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

Constraints

1 ≤ N ≤ 100

1 ≤ a_i ≤ 4800

a_i is an integer.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

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

Sample Input 1

4
2100 2500 2700 2700

Sample Output 1

2 2

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

Sample Input 2

5
1100 1900 2800 3200 3200

Sample Output 2

3 5

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

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

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

Sample Input 3

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

Sample Output 3

1 1

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



Sample input:
4
2100 2500 2700 2700


Sample output:
2 2

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
color = []
other = 0
for a in A:
    if a < 400: color.append(1)
    elif a < 800: color.append(2)
    elif a < 1200: color.append(3)
    elif a < 1600: color.append(4)
    elif a < 2000: color.append(5)
    elif a < 2400: color.append(6)
    elif a < 2800: color.append(7)
    elif a < 3200: color.append(8)
    else: other += 1
c = len(set(color))
if color: print(c, c+other)
else: print(1, other)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
L = [0]*8
tourist = int()
for a in A:
    n = a//400
    if n > 7:
        tourist += 1
    else:
        L[n] = 1

cnt = int()
for l in L:
    if l == 1:
        cnt += 1

if cnt==0:
    print(1,tourist)
else:
    print(cnt, cnt+tourist)

Submission status: Accepted

Solution code:
N=int(input())

T=[0]*9

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

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

goukeimin=0



for i in range(8):
    goukeimin+=T[i]
if goukeimin==0:
    print(1,sum(T))
else:
    print(goukeimin,sum(T))

Submission status: Accepted

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

a.sort()

colors = [0,0,0,0,0,0,0,0]
mulch = 0

for i in a:
  if i < 400:
    colors[0] += 1
  elif i < 800:
    colors[1] += 1
  elif i < 1200:
    colors[2] += 1
  elif i < 1600:
    colors[3] += 1
  elif i < 2000:
    colors[4] += 1
  elif i < 2400:
    colors[5] += 1
  elif i < 2800:
    colors[6] += 1
  elif i < 3200:
    colors[7] += 1
  else:
    mulch += 1
    
if len([j for j in colors if j > 0]) > 0:
  mi = len([j for j in colors if j > 0])
else:
  mi = 1

if mulch > 0:
  if len([j for j in colors if j > 0]) == 0:
    ma = mulch
  else:  
    ma = mi + mulch
else:
  ma = mi
  
print(mi, ma)

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    a=list(map(int,readline().split()))

    flags=[False]*8
    free=0
    for i in range(n):
        if a[i]//400<=7:
            flags[a[i]//400]=1
        else:
            free+=1

    color_max=flags.count(1)+free
    color_min=max(1,flags.count(1))
    print(color_min,color_max)

if __name__=="__main__":
    main()

Submission status: Accepted

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

overRed = 0

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

min_num = 1 if c.count(True) == 0 and overRed != 0 else c.count(True)
max_num = c.count(True)+overRed

print(min_num,max_num)

Submission status: Accepted

Solution code:
maxColorNum = 8
rates = [False] * maxColorNum
overRed = 0
N = int(input())
people = list(map(int, input().split()))
for i in people:
    idx = i // 400
    if idx >= maxColorNum:
        overRed += 1
    else:
        rates[idx] = True
minNum = 1 if rates.count(True) == 0 and overRed != 0 else rates.count(True)
maxNum = rates.count(True) + overRed

print(str(minNum) + " " + str(maxNum))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
color = set([])
select = 0
for i in range(N):
  if A[i] <= 399:
    color.add(0)
  elif A[i] <= 799:
    color.add(1)
  elif A[i] <= 1199:
    color.add(2)
  elif A[i] <= 1599:
    color.add(3)
  elif A[i] <= 1999:
    color.add(4)
  elif A[i] <= 2399:
    color.add(5)
  elif A[i] <= 2799:
    color.add(6)
  elif A[i] <= 3199:
    color.add(7)  
  else:
    select += 1

if select == N:
  print(1,select)
  exit()
MIN = len(color)
MAX = MIN + select
print(MIN,MAX)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
As = list(map(lambda x: int(x)//400, input().split()))

As_other = [a for a in As if a<8]
reds = len(As)-len(As_other)

print(max(len(set(As_other)), 1), len(set(As_other))+reds)

Submission status: Accepted

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

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

if k != n:
  min_c = len(list(c))
  max_c = len(list(c)) + k
else:
  min_c = 1
  max_c = n
print(min_c, max_c)

Submission status: Accepted

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

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

if special==0:
    print(variety,variety)
elif variety==0:
    print(1,special)
else:
    print(variety,variety+special)

Submission status: Accepted

Solution code:
def check(score):
  if score >= 3200:
    return -1
  for i,rating in enumerate(scores):
    if rating[0] <= score <= rating[1]:
      return i
n = int(input())
a = list(map(int,input().split()))
thopes = 0
colors = set()
scores = [(1,399),(400,799),(800,1199),(1200,1599),(1600,1999),(2000,2399),(2400,2799),(2800,3199)]
for score in a:
  ind = check(score)
  if ind==-1:
    thopes+=1
  else:
    colors.add(ind)
n = len(colors)
print(max(1,n),thopes+n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
x = list(map(int,input().strip().split()))

rate = []
over = 0
for i in range(n):
  if x[i]//400 >=8:
    over += 1
  else:
    rate.append(x[i]//400)
elem = len(set(rate))

_min = elem
_max = elem +over
if elem  == 0:
  _min = 1
#if elem + over >=8:
#  _max = 8 

print(str(_min),str(_max))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[0]*9
for i in a:
  b[min(i//400,8)]+=1
print(max(8-b[:8].count(0),1),8-b[:8].count(0)+b[8])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
gray = 399
brown = 799
green = 1199
lblue = 1599
blue = 1999
yellow = 2399
orange = 2799
red = 3199
count = 0
result = [0, 0, 0, 0, 0, 0, 0, 0]
for i in a:
    if 0 < i <= gray:
        result[0] += 1
    elif gray < i <= brown:
        result[1] += 1
    elif brown < i <= green:
        result[2] += 1
    elif green < i <= lblue:
        result[3] += 1
    elif lblue < i <= blue:
        result[4] += 1
    elif blue < i <= yellow:
        result[5] += 1
    elif yellow < i <= orange:
        result[6] += 1
    elif orange < i <= red:
        result[7] += 1
    else:
        count += 1
minout = sum(i>0 for i in result)
maxout = minout + count
if minout == 0:
    minout = 1
print(minout, maxout)

Submission status: Accepted

Solution code:
from collections import Counter

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

colors = []
over = 0

for a in A:
    if 1 <= a <= 399:
        colors.append("gray")
    if 400 <= a <= 799:
        colors.append("brawn")
    if 800 <= a <= 1199:
        colors.append("green")
    if 1200 <= a <= 1599:
        colors.append("water")
    if 1600 <= a <= 1999:
        colors.append("blue")
    if 2000 <= a <= 2399:
        colors.append("yellow")
    if 2400 <= a <= 2799:
        colors.append("orange")
    if 2800 <= a <= 3199:
        colors.append("red")
    if 3200 <= a:
        over += 1

counter = Counter(colors)

if len(A) == over:
    print(1, over)
    exit()

if over > 0:
    max_num = len(counter) + over
    print(len(counter), max_num)
else:
    print(len(counter), len(counter))

Submission status: Accepted

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

colors = [False for _ in range(8)]

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

colors_cnt = colors.count(True)
# if they are all allmite, the minimum number is 1, not 0.
ans_min = max(colors_cnt, 1)
ans_max = colors.count(True) + allmite

print(ans_min, ans_max)

Submission status: Accepted

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

for i in a:
    col = i//400
    if 3200 <= i:
        c[8] += 1
    else:
        c[col] = 1
print(max(1,sum(c[:8])),sum(c))

Submission status: Accepted

Solution code:
import sys
import itertools
import copy
from collections import defaultdict

input = sys.stdin.readline

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

n = I()
mylist = [0 for i in range(8)]
mylist2 = MI()
num = 0

for i in mylist2:
    temp = i // 400
    if temp <= 7:
        mylist[temp] = 1
    else:
        num += 1
        
max = sum(mylist) + num

min = sum(mylist)
if min == 0:
    min = 1
    
print(str(min) + " " + str(max))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    rate_count = [0] * 13
    a = tuple(map(int, input().split()))
    for ae in a:
        rank = ae // 400
        rate_count[rank] += 1

    reds = sum(rate_count[8:])
    res = 0
    for i1 in range(8):
        res += rate_count[i1] > 0
    r_min = max(res, 1)
    r_max = res + reds
    print(r_min, r_max)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
 
n = int(sys.stdin.readline().rstrip())
a = [int(x) for x in sys.stdin.readline().rstrip().split()]
 
counter = [0,0,0,0,0,0,0,0]
counter_wild = 0
 
for x in a:
    if x < 400:
        counter[0] += 1
    elif x < 800:
        counter[1] += 1
    elif x < 1200:
        counter[2] += 1
    elif x < 1600:
        counter[3] += 1
    elif x < 2000:
        counter[4] += 1
    elif x < 2400:
        counter[5] += 1
    elif x < 2800:
        counter[6] += 1
    elif x < 3200:
        counter[7] += 1
    else:
        counter_wild += 1
 
c = len(list(filter(lambda x: x != 0,counter)))
 
if counter_wild == 0:
    minimum_num = c
    maximum_num = c
else:
    minimum_num = max(1,c)
    maximum_num = c+counter_wild
 
print(minimum_num,maximum_num)

Submission status: Accepted

Solution code:
import sys

n = int(sys.stdin.readline().rstrip())
a = [int(x) for x in sys.stdin.readline().rstrip().split()]

a_set = set()
counter_wild = 0
for x in a:
    if x>=3200:
        counter_wild+=1
    else:
        a_set.add(x//400)
print(max(1,len(a_set)),len(a_set)+counter_wild)

Submission status: Accepted

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

others = 0
rates = [False for i in range(8)]
for i in a:
    if i <= 399: rates[0] = True
    elif i <= 799: rates[1] = True
    elif i <= 1199: rates[2] = True
    elif i <= 1599: rates[3] = True
    elif i <= 1999: rates[4] = True
    elif i <= 2399: rates[5] = True
    elif i <= 2799: rates[6] = True
    elif i <= 3199: rates[7] = True
    else:
        others += 1
        
min_ans = rates.count(True)
if min_ans == 0: min_ans = 1
max_ans = rates.count(True)
if others > 0:
    max_ans += others

print(min_ans, max_ans)

Submission status: Accepted

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

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

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

## Logic

ans = [0,0,0,0,0,0,0,0]
tmp = 0

for i in range(0,N):
    if A[i] >= 3200:
        tmp += 1
    else:
        ans[A[i]//400] = 1

print(max(1,sum(ans)),sum(ans)+tmp)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
l=[]
for i in range(n):
    if a[i]<400:
        l.append("hai")
    elif a[i]<800:
        l.append("cha")
    elif a[i]<1200:
        l.append("midori")
    elif a[i]<1600:
        l.append("mizu")
    elif a[i]<2000:
        l.append("ao")
    elif a[i]<2400:
        l.append("ki")
    elif a[i]<2800:
        l.append("orange")
    elif a[i]<3200:
        l.append("red")
    else:
        l.append("free")
ls=set(l)
if "free" not in ls:
    print(len(ls),len(ls))
else:
    x=len(ls)-1#free以外の色の数
    y=x+l.count("free")
    #if y>8:
        #y=8
    
    if x==0:
        x=1
    print(x,y)

Submission status: Accepted

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

fix_color = set()
n_any_color = 0
for color in a:

  if color < 400:
    fix_color.add(400)
  elif color < 800:
    fix_color.add(800)
  elif color < 1200:
    fix_color.add(1200)
  elif color < 1600:
    fix_color.add(1600)
  elif color < 2000:
    fix_color.add(2000)
  elif color < 2400:
    fix_color.add(2400)
  elif color < 2800:
    fix_color.add(2800)
  elif color < 3200:
    fix_color.add(3200)
  else:
    n_any_color += 1

n_min = max(1, len(fix_color))
n_max = len(fix_color) + n_any_color
print(n_min, n_max)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
colors = [0]*9
for ai in a:
  if ai >= 3200:
    colors[8] += 1
  else:
    colors[ai//400] = 1
    
cmin = max(1, sum(colors[0:8]))
cmax = sum(colors)

print(cmin, cmax)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict


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

    color = defaultdict(int)

    for aa in a:
        if aa < 3200:
            color[aa//400] += 1
        else:
            color[8] += 1

    min_ans = len(color)
    max_ans = len(color)

    if 8 in color:
        min_ans = max(1, min_ans-1)
        max_ans += color[8] - 1

    print(min_ans, max_ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
li = [0]*9

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

for i in a:
    if i//400 > 7:
        li[8] += 1
    else:
        li[i//400] = 1

print(max(1,sum(li[:-1])),sum(li))

Submission status: Accepted

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

ans = [0]*8
leng = 0

for i in range(N):
    now = A[i]//400
    if now < 8:
        ans[now] = 1
    else:
        leng += 1

mi = sum(ans) if sum(ans) > 0 else 1
print(mi, sum(ans) + leng)

Submission status: Accepted

Solution code:
def main():
    DIFF = 400

    N = int(input())

    ctr = [0] * 9
    for x in map(int, input().split()):
        ctr[min(x // DIFF, 8)] += 1

    le_red = sum(c > 0 for c in ctr[:8])
    gt_red = ctr[8]

    if gt_red:
        if le_red:
            print(le_red, le_red + gt_red)
        else:
            print(1, gt_red)
    else:
        print(le_red, le_red)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = [0]*8
leng = 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
    else:
        leng += 1

mi = sum(ans) if sum(ans) > 0 else 1
print(mi, sum(ans) + leng)

Submission status: Accepted

Solution code:

import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    check=[0]*8
    tuyo=0
    for i in l:
        x=i//400
        if x>=8:
            tuyo+=1
        else:
            check[x]+=1
    if tuyo==n:
        print(1,tuyo)
    else:
        cnt=0
        for j in check:
            if j>0:
                cnt+=1
        print(cnt,cnt+tuyo)
resolve()

Submission status: Accepted

Solution code:
import math
import numpy as np

n = int(input())
a = list(map(int, input().split()))
check = [0] * 9
for i, val in enumerate(a):
    tar = math.floor(val / 400)
    if (tar > 8):
        tar = 8

    check[int(tar)] += 1


checkA = np.array(check[:8])
#print(checkA)
num = np.count_nonzero(checkA != 0)

less = max(num, 1)
#more = min(8, num + check[8])
more = num + check[8]
# print(check[8])

print(less, more)
'''
checkA = np.array(check[:8])
num = np.count_nonzero(checkA != 0)
if (num == 0):
    num = 1
rest = 8 - num

more = min(8, num + check[8])

print(num, more)
'''

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
bo = [False] * 8
free = 0
for x in a:
    now = x//400
    if now < 8:
        bo[now] = True
    else:
        free += 1
mi = sum(bo) if sum(bo) > 0 else 1
print(mi, sum(bo) + free)

Submission status: Accepted

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

cnt = [0] * 9
free = 0

for _a in a:
    r = _a//400
    if r < 8:
        cnt[r] = 1
    else:
        free += 1

if free == n:
    print(1, free)
else:
    print(sum(cnt), sum(cnt) + free)

Submission status: Accepted

Solution code:
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(input())
a = readints()
ans = []
for i in range(n):
    if 1 <= a[i] and a[i] <= 399:
        ans.append('hai')
    if 400 <= a[i] and a[i] <= 799:
        ans.append('tya')
    if 800 <= a[i] and a[i] <= 1199:
        ans.append('midori')
    if 1200 <= a[i] and a[i] <= 1599:
        ans.append('mizu')
    if 1600 <= a[i] and a[i] <= 1999:
        ans.append('ao')
    if 2000 <= a[i] and a[i] <= 2399:
        ans.append('ki')
    if 2400 <= a[i] and a[i] <= 2799:
        ans.append('daidai')
    if 2800 <= a[i] and a[i] <= 3199:
        ans.append('aka')
    if a[i] >= 3200:
        ans.append('nanndemoii')
tmp = 0
for i in range(n):
    if ans[i] == 'nanndemoii':
        tmp += 1
if tmp == n:
    print(1, n)
    exit()
# print(ans)
set_ans = list(set(ans))
# print(set_ans)
min_cnt = 0
for i in range(len(set_ans)):
    if set_ans[i] != 'nanndemoii':
        min_cnt += 1
# print(min_cnt)
max_cnt = 0
for i in range(n):
    if ans[i] == 'nanndemoii':
        max_cnt += 1
max_cnt += min_cnt
print(min_cnt, max_cnt)

Submission status: Accepted

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

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

mx = sum(count[:8]) + count[8]
mn = 0
if sum(count[:8]) == 0 and count[8] != 0:
    mn = 1
else:
    mn = sum(count[:8])

print(mn, mx)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
  n = int(input())
  aa = list(map(int, input().split()))
  s = set()
  num = 0
  for a in aa:
    if a >= 3200:
      num += 1
    else:
      s.add(a // 400)
  print(max(len(s), 1), len(s) + num)
  return

if __name__ == "__main__":
  resolve()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
ls = [0]*8
now = 0
for i in range(N):
  if 3200 <= A[i]:
    now += 1
  else:
    ls[A[i]//400] += 1
if 8-ls.count(0) >= 1:
  minimum = 8-ls.count(0)
else:
  minimum = 1
print(minimum,8-ls.count(0)+now)

Submission status: Accepted

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

cnt = 0
ALL = set()
for a in A:
    c = a//400
    if c >= 8:
        cnt+= 1
    else:
        ALL.add(c)

if len(ALL) == 0:
    print(1,cnt)
else:
    print(len(ALL),len(ALL)+cnt)

Submission status: Accepted

Solution code:
n = int(input())
rates = set()
over = 0
people = list(map(int, input().split()))
for rate in people:
    if rate // 400 >= 8:
        over += 1
    else:
        rates.add(rate // 400)
print(max(1, len(rates)), len(rates) + over)

Submission status: Accepted

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

cnt = [0] * 8
free = 0

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

if free == n:
    print(1, free)
else:
    print(sum(cnt), sum(cnt) + free)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    Color = [0] * 9
    for a in A:
        if a >= 3200:
            Color[-1] += 1
        else:
            Color[a // 400] = 1

    mi = sum(Color[:8]) + (1 if sum(Color[:8]) == 0 and Color[8] > 0 else 0)
    ma = sum(Color[:8]) + Color[8]

    print(mi, ma)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
  if 1<=a[i]<=399:
    a[i]="gray"
  elif 400<=a[i]<=799:
    a[i]="brown"
  elif 800<=a[i]<=1199:
    a[i]="green"
  elif 1200<=a[i]<=1599:
    a[i]="lightblue"
  elif 1600<=a[i]<=1999:
    a[i]="blue"
  elif 2000<=a[i]<=2399:
    a[i]="yellow"
  elif 2400<=a[i]<=2799:
    a[i]="orange"
  elif 2800<=a[i]<=3199:
    a[i]="red"
  elif 3200<=a[i]:
    a[i]="free"

from collections import Counter

c=Counter(a)
ans=len(c)
free=c["free"]
v_min=ans
v_max=ans
if free>0:
  v_min-=1
if free>0:
  v_max+=free-1
if free==n:
  v_min=1
print(v_min,v_max)

Submission status: Accepted

Solution code:
import sys
import collections

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()

N = ni()
A = nl()


def solve():
    c = collections.Counter()
    cf = 0
    for a in A:
        if a < 400:
            c[0] += 1
        elif a < 800:
            c[1] += 1
        elif a < 1200:
            c[2] += 1
        elif a < 1600:
            c[3] += 1
        elif a < 2000:
            c[4] += 1
        elif a < 2400:
            c[5] += 1
        elif a < 2800:
            c[6] += 1
        elif a < 3200:
            c[7] += 1
        else:
            cf += 1
    mn = len(c)
    if mn == 0 and cf > 0:
        mn = 1
    mx = len(c) + cf
    print(mn, mx)


solve()

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
c = []
other = 0
for a in A:
  if a < 400: c.append("gray")
  elif a < 800: c.append("brown")
  elif a < 1200: c.append("green")
  elif a < 1600: c.append("mblue")
  elif a < 2000: c.append("blue")
  elif a < 2400: c.append("yellow")
  elif a < 2800: c.append("orange")
  elif a < 3200: c.append("red")
  else: other += 1
c = set(c)
if c:
  print(len(c), len(c)+other)
else:
  print(1, other)

Submission status: Accepted

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

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

base = sum(d[:-1])
mx = base + d[8]
mn = max(1, base)
print(mn, mx)

Submission status: Accepted

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

cs = [0]*9
for a in A:
    if a >= 3200:
        cs[-1] += 1
    else:
        cs[a//400] += 1
mn = len([1 for c in cs[:-1] if c>0])
if mn==0:
    print(1,N)
else:
    print(mn,mn+cs[-1])

Submission status: Accepted

Solution code:
from bisect import bisect_left

N = int(input())
a = sorted(list(map(int, input().split())))
ans = set()
max_ans = 0
c = 0
for aa in a:
  if aa < 400:
    ans.add(0)
  elif aa < 800:
    ans.add(1)
  elif aa < 1200:
    ans.add(2)
  elif aa < 1600:
    ans.add(3)
  elif aa < 2000:
    ans.add(4)
  elif aa < 2400:
    ans.add(5)
  elif aa < 2800:
    ans.add(6)
  elif aa < 3200:
    ans.add(7)
  else:
    if not ans:
      ans.add(0)
      continue
    max_ans += 1

print(len(ans), len(ans) + max_ans if max_ans else len(ans))