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:
from collections import OrderedDict
rate = (
  ('gray', 400),
  ('brown', 800),
  ('green', 1200),
  ('water', 1600),
  ('blue', 2000),
  ('yellow', 2400),
  ('orange', 2800),
  ('red', 3200),
  ('rainbow', 4801),
)

n = int(input())
a = []
for i in map(int, input().split()):
  for color, border in rate:
    if i < border:
      a.append(color)
      break

rainbow = 0
colors = list(set(a))
if 'rainbow' in colors:
  rainbow = a.count('rainbow')
  colors.remove('rainbow')
  if len(colors) == 0:
    colors.append('rainbow')
    print(len(colors), rainbow)
    exit(0)

print(len(colors), len(colors)+rainbow)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a1=0
a2=0
a3=0
a4=0
a5=0
a6=0
a7=0
a8=0
wild=0
for i in range(n):
    if 0<=a[i]<=399:
        a1+=1
    elif 400<=a[i]<=799:
        a2+=1
    elif 800<=a[i]<=1199:
        a3+=1
    elif 1200<=a[i]<=1599:
        a4+=1
    elif 1600<=a[i]<=1999:
        a5+=1
    elif 2000<=a[i]<=2399:
        a6+=1
    elif 2400<=a[i]<=2799:
        a7+=1
    elif 2800<=a[i]<=3199:
        a8+=1
    else:
        wild+=1
ans=0
r=[]
r.append(a1)
r.append(a2)
r.append(a3)
r.append(a4)
r.append(a5)
r.append(a6)
r.append(a7)
r.append(a8)
for i in range(8):
    if r[i]!=0:
        ans+=1
print(max(ans,1),ans+wild)

Submission status: Accepted

Solution code:
from collections import Counter as C
N = int(input())
A = C([min(int(a)//400, 8) for a in input().split()])

a = sum([A[i]>0 for i in range(8)])
print(max(a, 1), a+A[8])

Submission status: Accepted

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

if ans==0:
  ans=1
print(ans,ans1)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
C=set()
d=0
for a in A:
    c=a//400
    if c<8:C.add(c)
    else:d+=1
print(max(len(C),1),len(C)+d)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
gray, brown, green, sky_blue, blue, yellow, orange, red = [0] * 8
N = int(input())
alist = list(map(int, input().split()))
free = 0
for a in alist:
    if 1 <= a <= 399:
        gray += 1
    elif 400 <= a <= 799:
        brown += 1
    elif 800 <= a <= 1199:
        green += 1
    elif 1200 <= a <= 1599:
        sky_blue += 1
    elif 1600 <= a <= 1999:
        blue += 1
    elif 2000 <= a <= 2399:
        yellow += 1
    elif 2400 <= a <= 2799:
        orange += 1
    elif 2800 <= a <= 3199:
        red += 1
    else:
        free += 1
colors = [color for color in [gray, brown, green, sky_blue, blue, yellow, orange, red] if color > 0]
print(max(1, len(colors)), len(colors) + free)

Submission status: Accepted

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

C=[0,0,0,0,0,0,0,0]
R=0

for i in range(N):
    if a[i]<3200:
        C[a[i]//400]+=1
    else:
        R+=1
#print(C,R)
m=0
for i in range(8):
    if C[i]>0:
        m+=1
if m==0:
    print(1,R)
else:
    print(m,m+R)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
mighty = 0
s = set()
for x in A:
    if x < 400:
        s.add('gray')
    elif x < 800:
        s.add('brown')
    elif x < 1200:
        s.add('green')
    elif x < 1600:
        s.add('water')
    elif x < 2000:
        s.add('blue')
    elif x < 2400:
        s.add('yellow')
    elif x < 2800:
        s.add('orange')
    elif x < 3200:
        s.add('red')
    else:
        mighty += 1
answer = max(1, len(s))
answer_max = answer + mighty
answer_max = min(answer_max, N)
print(answer, answer_max)

Submission status: Accepted

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

def col(x):
  if x >= 1 and x <= 399:
    return 'glay'
  elif x >= 400 and x <= 799:
    return 'brown'
  elif x >= 800 and x <= 1199:
    return 'green'
  elif x >= 1200 and x <= 1599:
    return 'light-blue'
  elif x >= 1600 and x <= 1999:
    return 'blue'
  elif x >= 2000 and x <= 2399:
    return 'yellow'
  elif x >= 2400 and x <= 2799:
    return 'orange'
  elif x >= 2800 and x <= 3199:
    return 'red'
  else:
    return 'joker'

Col_Lst = []
count = 0
count_joker = 0
for num in range(N):
  color = col(lst[num])
  if color == 'joker':
    count_joker += 1
  else:
    if color in Col_Lst:
      pass
    else:
      count += 1
  Col_Lst.append(color)

mn = 0
mx = 0
if count == 0:
  mn = 1
  mx = count_joker
else:
  mn = count
  mx = count + count_joker
  
print('%d %d' %(mn, mx))

Submission status: Accepted

Solution code:
def examC():
    N = I()
    a = LI()
    d = defaultdict(int)
    for i in a:
        d[min(i//400,8)] += 1
    ansL = len(d)
    ansR = len(d)
    if d[8]!=0:
        ansL = max(ansL-1,1)
        ansR = ansR + d[8]-1
    print(ansL, ansR)


import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()

Submission status: Accepted

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

Submission status: Accepted

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

agg = [0] * 9
free = 0

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

minimum = len([x for x in agg if x > 0])
maximum = minimum + free
if minimum == 0:
    minimum = 1

print(minimum, maximum)

Submission status: Accepted

Solution code:
#Colorful Leaderboard
N = int(input())
a = list(map(int, input().split()))
L = [0 for i in range(8)]
s = 0
for i in range(N):
    if a[i] < 3200:
        L[a[i]//400] = L[a[i]//400] + 1
    else:
        s = s + 1
n = 0
for i in range(8):
    if L[i] > 0:
        n = n + 1
nmin = n
nmax = n + s
if nmin == 0:
    nmin = 1
print(str(nmin)+" "+str(nmax))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [0 for _ in range(9)]
for a in map(int,input().split()):
  A[min(a//400,8)]+=1
rate_num = 8-A[:-1].count(0)
print(max(1,rate_num), rate_num+A[-1])

Submission status: Accepted

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

cnt=[0]*8
count=0
for i in range(n):
    if a[i]>=1 and a[i]<=399:
        cnt[0]=1
    elif a[i]>=400 and a[i]<=799:
        cnt[1]=1
    elif a[i]>=800 and a[i]<=1199:
        cnt[2]=1
    elif a[i]>=1200 and a[i]<=1599:
        cnt[3]=1
    elif a[i]>=1600 and a[i]<=1999:
        cnt[4]=1
    elif a[i]>=2000 and a[i]<=2399:
        cnt[5]=1
    elif a[i]>=2400 and a[i]<=2799:
        cnt[6]=1
    elif a[i]>=2800 and a[i]<=3199:
        cnt[7]=1
    else:
        count+=1
min_ans=sum(cnt)
if min_ans==0 and count>=1:
    min_ans=1
    count-=1

print(str(min_ans)+' '+str(min_ans+count))

Submission status: Accepted

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

cnt=[0]*8
count=0
for i in range(n):
    if a[i]>=1 and a[i]<=399:
        cnt[0]=1
    elif a[i]>=400 and a[i]<=799:
        cnt[1]=1
    elif a[i]>=800 and a[i]<=1199:
        cnt[2]=1
    elif a[i]>=1200 and a[i]<=1599:
        cnt[3]=1
    elif a[i]>=1600 and a[i]<=1999:
        cnt[4]=1
    elif a[i]>=2000 and a[i]<=2399:
        cnt[5]=1
    elif a[i]>=2400 and a[i]<=2799:
        cnt[6]=1
    elif a[i]>=2800 and a[i]<=3199:
        cnt[7]=1
    else:
        count+=1
min_ans=sum(cnt)

if count==0:
    min1=min_ans
elif min_ans==0:
    min1=1
else:
    min1=max(1,min_ans)
max1=min_ans+count
print(min1,max1)

Submission status: Accepted

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

ans = [0] * 8
over_3200 = 0

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

print(max(sum(ans), 1), end=' ')
print(sum(ans) + over_3200)

Submission status: Accepted

Solution code:
N=int(input())
A = list(map(int, input().split()))
gray=any([1<=i<=399 for i in A])
brown=any([400<=i<=799 for i in A])
green=any([800<=i<=1199 for i in A])
sky=any([1200<=i<=1599 for i in A])
blue=any([1600<=i<=1999 for i in A])
yellow=any([2000<=i<=2399 for i in A])
orange=any([2400<=i<=2799 for i in A])
red=any([2800<=i<=3199 for i in A])
color_list=[gray,brown,green,sky,blue,yellow,orange,red]
count= color_list.count(True)
change=len([i for i in A if 3200<=i])
if count==0:
    print(1,change)
else:
    print(count,count+change)

Submission status: Accepted

Solution code:

a=int(input())
b=[]
c=[0,0,0,0,0,0,0,0,0]
ans1=0
ans2=0
jdg=0

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

for i in range(a):
    if(int(b[i])<3200):
        jdg=int(b[i]/400)
        c[jdg]+=1
    else:
        c[8]+=1

for i in range(8):
    if(c[i] >= 1):
        ans1+=1
ans2=ans1+c[8]
if(ans1==0):
    ans1=1

print('%d %d' % (ans1, ans2))

Submission status: Accepted

Solution code:
people = int(input())
rates = list(map(int, input().split(' ')))
colors = [0 for i in range(8)]

color_var = 0
for i in range(people):
    if rates[i] // 400 <= 7:
        if colors[rates[i] // 400] == 0 :
            colors[rates[i] // 400] += 1
    else:
        color_var += 1
        
min_colors = max(colors.count(1), 1)
max_colors = colors.count(1) + color_var

print(min_colors, max_colors)

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
col=[False for i in range(8)]
val=0
count=0
for i in range(n):
  m=l[i]
  if m<400:
    col[0]=True
  if 400<=m<800:
    col[1]=True
  if 800<=m<1200:
    col[2]=True
  if 1200<=m<1600:
    col[3]=True
  if 1600<=m<2000:
    col[4]=True
  if 2000<=m<2400:
    col[5]=True
  if 2400<=m<2800:
    col[6]=True
  if 2800<=m<3200:
    col[7]=True
  if m>=3200:
    val+=1
for i in range(8):
  if col[i]:
    count+=1
print(max(1,count),count+val)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
c=[0,0,0,0,0,0,0,0]
d=0
for x in a:
  if x<400 and c[0]==0:
    c[0]+=1
  elif 399<x<800 and c[1]==0:
    c[1]+=1
  elif 799<x<1200 and c[2]==0:
    c[2]+=1
  elif 1199<x<1600 and c[3]==0:
    c[3]+=1
  elif 1599<x<2000 and c[4]==0:
    c[4]+=1
  elif 1999<x<2400 and c[5]==0:
    c[5]+=1
  elif 2399<x<2800 and c[6]==0:
    c[6]+=1
  elif 2799<x<3200 and c[7]==0:
    c[7]+=1
  elif 3199<x:
    d+=1
e=sum(c)
print(max(e,1),e+d)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
data=[0]*9
for i in range(n):
    if a[i]//400>=8:
        data[8]+=1
    else:
        data[a[i]//400]+=1
count=0
for i in range(8):
    if data[i]!=0:
        count+=1
if count==0:
    print("1"+" "+str(data[8]))
else:
    print(str(count)+" "+str(count+data[8]))

Submission status: Accepted

Solution code:
import copy
import heapq
import math
import fractions

def j(n):
    if n:print("Yes")
    else:print("No")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printmultiplerow(a):
    for i in a:
        print(i)
def printrow(a):
    for i in range(len(a)-1):
        print(a[i],end = " ")
    print(a[-1])



n = ip()
a = iprow()
for i in range(n):
    a[i]//=400
any = 0
for i in range(n):
    if a[i] >=8:
        a[i]=-1
        any+=1
for i in range(n-1,-1,-1):
    if a[i]==-1:
        a.pop(i)
l = len(set(a))
print(max(1,l),l+any)

Submission status: Accepted

Solution code:
N = int(input())
an = list(map(int, input().split()))
over_cnt = 0
colors = []
for a in an:
    rate = a // 400
    if rate >= 8:
        over_cnt += 1
    elif rate not in colors:
        colors.append(rate)

print(max(len(colors), 1), len(colors) + over_cnt)

Submission status: Accepted

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

def main():
  n,a = read_input()
  l = [0 for i in range(8)]
  experts = 0
  for score in a:
    if score > 3199:
      experts += 1
    else:
      l[score//400] += 1
  minimum = 8-l.count(0)
  maximum = minimum + experts
  if minimum == 0:
    minimum = 1
  print(minimum, maximum)

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
a.sort()
c = [0] * 9
for i in range(N):
  if a[i] // 400 > 8:
    c[8] += 1
  else:
    c[a[i] // 400] += 1
res = 0
for i in range(8):
  res += c[i] > 0
print(max(res, 1), res + c[8])

Submission status: Accepted

Solution code:
N = int(input())
List = input().split()
counter = [0 for _ in range(8)]
prime = 0
for item in List:
  if int(item) >=3200:
    prime +=1
  else:
    num = int(item)//400
    counter[num] += 1

minimum = max(8 - counter.count(0),1)
if counter.count(0) != 8:
  maximum = minimum + prime
else:
  maximum = prime
  
print(minimum, maximum)

Submission status: Accepted

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

N = int(input())
rating = [int(r) for r in input().split()]
rating.sort()

color = ['gray', 'brown', 'green', 'cyan', 'blue', 'yellow', 'orange', 'red']
c_count = {c: 0 for c in color}

count_over = 0
for r in rating:
    if r < 400:    c_count[color[0]] += 1
    elif r < 800:  c_count[color[1]] += 1
    elif r < 1200: c_count[color[2]] += 1
    elif r < 1600: c_count[color[3]] += 1
    elif r < 2000: c_count[color[4]] += 1
    elif r < 2400: c_count[color[5]] += 1
    elif r < 2800: c_count[color[6]] += 1
    elif r < 3200: c_count[color[7]] += 1
    else:          count_over += 1
     
dif_c_count = 0
for v in c_count.values():
    if v != 0: dif_c_count += 1 

mini, maxi = dif_c_count if dif_c_count != 0 else 1, dif_c_count + count_over
print(mini, maxi)

Submission status: Accepted

Solution code:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    A = string_to_int(inputs[0])
    rate = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
    rate_num = len(rate)

    counter_overs = 0
    rate_set = set()
    for a in A:
        if a >= 3200:
            counter_overs += 1
        else:
            hit = None
            for i, r in enumerate(reversed(rate)):
                if a <= r:
                    hit = i
            rate_set.add(hit)
    if len(rate_set) == 0:
        # max_num = counter_overs if counter_overs <= rate_num else rate_num
        max_num = counter_overs
        min_num = 1
    else:
        sum_all = len(rate_set) + counter_overs
        # max_num = sum_all if sum_all <= rate_num else rate_num
        max_num = sum_all
        min_num = len(rate_set)
    return "{} {}".format(min_num, max_num)


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)

Submission status: Accepted

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

    R = [1]
    for i in range(1, 8):
        R.append(400 * i)
    # print(R)
    
    st = set()
    free = 0
    for ai in A:
        if ai >= 3200:
            free += 1
            continue
        for ri in R[::-1]:
            if ai >= ri:
                st.add(ri)
                break
    # print(st)
    # print(free)
    

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import numpy as np

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

colors = np.array([0 for _ in range(9)])
for a in A:
    if 1 <= a <= 399: colors[0] += 1
    elif 400 <= a <= 799: colors[1] += 1
    elif 800 <= a <= 1199: colors[2] += 1
    elif 1200 <= a <= 1599: colors[3] += 1
    elif 1600 <= a <= 1999: colors[4] += 1
    elif 2000 <= a <= 2399: colors[5] += 1
    elif 2400 <= a <= 2799: colors[6] += 1
    elif 2800 <= a <= 3199: colors[7] += 1
    else: colors[8] += 1

if colors[8] == 0:
    ans = len(colors[colors > 0])
    print(ans, ans)
else:
    legend = colors[8]
    colors = colors[:8]
    v = len(colors[colors > 0])
    print(max(1, v), v + legend)

Submission status: Accepted

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

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

tmp = 0
for i in range(len(check) - 1):
    if check[i] >= 1:
        tmp += 1

ans_min = max(1, tmp)
ans_max = tmp + check[-1]

ans = str(ans_min) + ' ' + str(ans_max)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list( map(int,input().split()) )
flag = [0 for i in range(8)]
n = 0
c = 0
for a in A:
  if a  >= 3200:
    n += 1
  elif flag[a//400] == 0:
    flag[a//400] = 1
    c += 1

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
r_table = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
rate = [0]*8
god = 0
for x in a:
    for id, y in enumerate(r_table):
        if x >= y:
            if id == 8:
                god += 1
                break
        else:
            rate[id-1] = 1
            break
print(max(sum(rate), 1), sum(rate) + god)

Submission status: Accepted

Solution code:
from collections import Counter

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

da = [ai//400 for ai in aa if ai<3200]
over = sum([ai>=3200 for ai in aa])

c = Counter(da)

min_v = max(1,len(c))
max_v = len(c)+over

print(min_v,max_v)

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
b = []
max = 0
r = (0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200)
for i in range(n):
    if int(a[i]) >= 3200:
        max += 1
    else:
        for j in range(len(r)-1):
            if int(r[j]) <= int(a[i]) < int(r[j+1]):
                b.append(r[j])

min = len(set(b))
print(str(min)+' '+str(min+max) if min != 0 else '1'+' '+str(max))

Submission status: Accepted

Solution code:
N = int(input())
Data = list(map(int,input().split()))
Kind = [0] * 9
for d in Data:
    if d < 400:
        Kind[0] += 1
    elif d < 800:
        Kind[1] += 1
    elif d < 1200:
        Kind[2] += 1
    elif d < 1600:
        Kind[3] += 1
    elif d < 2000:
        Kind[4] += 1
    elif d < 2400:
        Kind[5] += 1
    elif d < 2800:
        Kind[6] += 1
    elif d < 3200:
        Kind[7] += 1
    else:
        Kind[8] += 1
k = 0
for i in range(8):
    if Kind[i] > 0:
        k += 1
if Kind[8] == 0:
    min1 = k
elif k == 0:
    min1 = 1
else:
    min1 = max(1,k)
max1 = k + Kind[8]
print(min1,max1)

Submission status: Accepted

Solution code:
N=int(input())
A=sorted(list(map(int,input().split())))
A=[i//400 for i in A]

Colors=[0,0,0,0,0,0,0,0,0]
for i in A:
    if i>=8:
        Colors[8]+=1
    else:
        Colors[i]+=1

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

print(max(Count,1),Count+Colors[-1])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, a: "List[int]"):
    color = set()
    rainbow_count = 0
    for i in range(N):
        if a[i]<=399:
            color.add("gray")
        elif a[i]<=799:
            color.add("brown")
        elif a[i]<=1199:
            color.add("green")        
        elif a[i]<=1599:
            color.add("lightblue")        
        elif a[i]<=1999:
            color.add("blue")        
        elif a[i]<=2399:
            color.add("yellow")
        elif a[i]<=2799:
            color.add("orange")        
        elif a[i]<=3199:
            color.add("red")
        else:
            rainbow_count+=1
    
    min_answer = len(color)
    max_answer = len(color) + rainbow_count
    
    if not color and rainbow_count >0:
      min_answer=1
      max_answer=rainbow_count
    print(min_answer,max_answer)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
ary = list(map(int, input().split()))
dic = {'gray': 0, 'brawn': 0, 'green': 0, 'water': 0, 'blue': 0, 'yellow': 0, 'orange': 0, 'red': 0}
god = 0

for rate in ary:
    if 0 <= rate < 400:
        dic['gray'] = 1
    elif 400 <= rate < 800:
        dic['brawn'] = 1
    elif 800 <= rate < 1200:
        dic['green'] = 1
    elif 1200 <= rate < 1600:
        dic['water'] = 1
    elif 1600 <= rate < 2000:
        dic['blue'] = 1
    elif 2000 <= rate < 2400:
        dic['yellow'] = 1
    elif 2400 <= rate < 2800:
        dic['orange'] = 1
    elif 2800 <= rate < 3200:
        dic['red'] = 1
    else:
        god += 1
cnt = sum(dic.values())
if cnt == 0:
    print(1, god)
else:
    print(cnt, cnt+god)

Submission status: Accepted

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

def get_color(point):
    color = ''
    if 400 > point:
        color = 'grey'
    elif 800 > point:
        color = 'brown'
    elif 1200 > point:
        color = 'green'
    elif 1600 > point:
        color = 'light blue'
    elif 2000 > point:
        color = 'blue'
    elif 2400 > point:
        color = 'yellow'
    elif 2800 > point:
        color = 'orange'
    elif 3200 > point:
        color = 'red'
    else:
        color = 'free'
    return color
dict = {}
for i in range(N):
    color = get_color(a[i])
    if color not in dict.keys():
        dict[color] = 1
    else:
        dict[color] += 1

min_cnt = 0
max_cnt = 0
if 'free' not in dict.keys():
    min_cnt = max_cnt = len(dict.keys())
else:
    min_cnt = max(1, len(dict.keys())-1)
    max_cnt = len(dict.keys())-1 + dict['free']

print(min_cnt, max_cnt)

Submission status: Accepted

Solution code:
n = int(input())

colors = [0] * 13
for i in list(map(int, input().split())):
    colors[i//400] += 1

ans = 8 - colors[:8].count(0)
free = sum(colors[8:])

print(max(1, ans), max(1, ans + free))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
color = set()
free = 0
for i in range(n):
    if a[i] < 3200:
        color.add(a[i]//400)
    else:
        free += 1
print("{} {}".format(max(1, len(color)), free + len(color)))

Submission status: Accepted

Solution code:
n=int(input())
l=[int(i) for i in input().split()]
c=[0]*8 
ind=0 
for i in l:
    if 1<=i<=399:
        c[0]+=1 
    if 400<=i<=799:
        c[1]+=1 
    if 800<=i<=1199:
        c[2]+=1 
    if 1200<=i<=1599:
        c[3]+=1 
    if 1600<=i<=1999:
        c[4]+=1 
    if 2000<=i<=2399:
        c[5]+=1 
    if 2400<=i<=2799:
        c[6]+=1 
    if 2800<=i<=3199:
        c[7]+=1 
    if i>=3200:
        ind+=1 
s=sum(i>0 for i in c)
#+=ind 
print(max(s,1),s+ind)

Submission status: Accepted

Solution code:
def check(ai, ratemax, d):
    if 3199 < ai:
        ratemax += 1
    else:
        d[ai // 400] = 1
    return ratemax


def main():
    N, *a = map(int, open(0).read().split())
    lst = [0] * 8
    ratemax = 0
    for ai in a:
        ratemax = check(ai, ratemax, lst)
    print(sum(lst) if sum(lst) else 1, sum(lst) + ratemax)
    return


main()

Submission status: Accepted

Solution code:
from collections import defaultdict


def check(ai, ratemax, d):
    if 3199 < ai:
        ratemax += 1
    else:
        d[ai // 400] += 1
    return ratemax


def main():
    N, *a = map(int, open(0).read().split())
    d = defaultdict(lambda: 0)
    ratemax = 0
    for ai in a:
        ratemax = check(ai, ratemax, d)
    print(len(d) if len(d) else 1, len(d) + ratemax)
    return


main()

Submission status: Accepted

Solution code:
from collections import defaultdict


def check(ai, ratemax, d):
    if 1 <= ai <= 399:
        d[0] += 1
    elif 400 <= ai <= 799:
        d[1] += 1
    elif 800 <= ai <= 1199:
        d[2] += 1
    elif 1200 <= ai <= 1599:
        d[3] += 1
    elif 1600 <= ai <= 1999:
        d[4] += 1
    elif 2000 <= ai <= 2399:
        d[5] += 1
    elif 2400 <= ai <= 2799:
        d[6] += 1
    elif 2800 <= ai <= 3199:
        d[7] += 1
    else:
        ratemax += 1
    return ratemax


def main():
    N, *a = map(int, open(0).read().split())
    d = defaultdict(lambda: 0)
    ratemax = 0
    for ai in a:
        ratemax = check(ai, ratemax, d)
    print(len(d) if len(d) else 1, len(d) + ratemax)
    return


main()

Submission status: Accepted

Solution code:
from collections import defaultdict


def check(x, ratemax, d):
    if 1 <= x <= 399:
        d[0] += 1
    elif 400 <= x <= 799:
        d[1] += 1
    elif 800 <= x <= 1199:
        d[2] += 1
    elif 1200 <= x <= 1599:
        d[3] += 1
    elif 1600 <= x <= 1999:
        d[4] += 1
    elif 2000 <= x <= 2399:
        d[5] += 1
    elif 2400 <= x <= 2799:
        d[6] += 1
    elif 2800 <= x <= 3199:
        d[7] += 1
    else:
        ratemax += 1
    return ratemax


def main():
    N, *a = map(int, open(0).read().split())
    d = defaultdict(lambda: 0)
    ratemax = 0
    for x in a:
        ratemax = check(x, ratemax, d)
    print(len(d) if len(d) else 1, len(d) + ratemax)
    return


main()

Submission status: Accepted

Solution code:
from collections import defaultdict


def main():
    N, *a = map(int, open(0).read().split())
    d = defaultdict(lambda: 0)
    ratemax = 0
    for x in a:
        if 1 <= x <= 399:
            d[0] += 1
        elif 400 <= x <= 799:
            d[1] += 1
        elif 800 <= x <= 1199:
            d[2] += 1
        elif 1200 <= x <= 1599:
            d[3] += 1
        elif 1600 <= x <= 1999:
            d[4] += 1
        elif 2000 <= x <= 2399:
            d[5] += 1
        elif 2400 <= x <= 2799:
            d[6] += 1
        elif 2800 <= x <= 3199:
            d[7] += 1
        else:
            ratemax += 1
    print(len(d) if len(d) else 1, len(d) + ratemax)
    return


main()

Submission status: Accepted

Solution code:
N = int(input())
A = sorted(list(map(int,input().split())))
G = {i:0 for i in range(9)}
for i in range(N):
    if A[i]<=399:
        G[0] += 1
    elif A[i]<=799:
        G[1] += 1
    elif A[i]<=1199:
        G[2] += 1
    elif A[i] <= 1599:
        G[3] += 1
    elif A[i] <= 1999:
        G[4] += 1
    elif A[i] <= 2399:
        G[5] += 1
    elif A[i] <= 2799:
        G[6] += 1
    elif A[i] <= 3199:
        G[7] += 1
    else:
        G[8] += 1
cnt = 0
for i in range(8):
    if G[i] > 0:
        cnt += 1
if cnt==0:
    cmin = 1
    cmax = G[8]
else:
    cmin = cnt
    cmax = cmin+G[8]
print(cmin,cmax)

Submission status: Accepted

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

FD = [0]*9

for i in range(n):
  if A[i]<3200:
    FD[A[i]//400] += 1
  else:
    FD[8] += 1

count = 0
for j in range(8):
  if FD[j]:
    count += 1

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