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 = list(map(int, input().split()))
r_list = [0]*9
for a in a_list:
	if a < 400:
		r_list[0] += 1
	elif a < 800:
		r_list[1] += 1
	elif a < 1200:
		r_list[2] += 1
	elif a < 1600:
		r_list[3] += 1
	elif a < 2000:
		r_list[4] += 1
	elif a < 2400:
		r_list[5] += 1
	elif a < 2800:
		r_list[6] += 1
	elif a < 3200:
		r_list[7] += 1
	else:
		r_list[8] += 1
min_count = 0
super_r = r_list.pop(-1)
for r in r_list:
	if r > 0:
		min_count += 1
max_count = super_r + min_count
if min_count == 0 and super_r > 0:
	min_count = 1
print(min_count, max_count)

Submission status: Accepted

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


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()


def minimum(l):
    c = 0
    for i in range(len(l)):
        if l[i] == 'choose':
            c += 1
    if len(l) == c:
        return 1
    while 'choose' in l:
        l.remove('choose')
        # print(l)
    x = list(set(l))
    return len(x)


color = []
for i in range(N):
    if 1 <= a[i] and a[i] <= 399:
        color.append('gray')
    elif 400 <= a[i] and a[i] <= 799:
        color.append('brown')
    elif 800 <= a[i] and a[i] <= 1199:
        color.append('green')
    elif 1200 <= a[i] and a[i] <= 1599:
        color.append('light blue')
    elif 1600 <= a[i] and a[i] <= 1999:
        color.append('blue')
    elif 2000 <= a[i] and a[i] <= 2399:
        color.append('yellow')
    elif 2400 <= a[i] and a[i] <= 2799:
        color.append('orange')
    elif 2800 <= a[i] and a[i] <= 3199:
        color.append('red')
    elif 3200 <= a[i]:
        color.append('choose')
cnt = color.count('choose')
while 'choose' in color:
    color.remove('choose')
print(minimum(color), len(set(color))+cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
 
color = ["gray","braun","green","watter","bruee","yellow","orange","red"]
 
lis = []
 
count = 0
 
for i in a:
    if 1 <= i <=399:
        lis.append("gray")
    
    if 400 <= i <= 799:
        lis.append("braun")
    
    if 800 <= i <= 1199:
        lis.append("green")
    
    if 1600 <= i <= 1999:
        lis.append("bruee")
 
    if 1200 <= i <= 1599:
        lis.append("watter")
    
    if 2000 <= i <= 2399:
        lis.append("yellow")
    
    if 2400 <= i <= 2799:
        lis.append("orange")
 
    if 2800 <= i <= 3199:
        lis.append("red")
    if 3200 <= i:
        count = count + 1
 
mincase = len(set(lis))
 
if len(set(lis)) == 0:
    mincase = 1
else:
    mincase = len(set(lis))
 
maxcase = len(set(lis)) + count
 
print(mincase , '', maxcase)

Submission status: Accepted

Solution code:
input()
a = list(map(int, input().split()))
counter = [False] * 8
colorfulcounter = 0

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

print(max(sum(counter), 1), end = " ")
print(sum(counter) + colorfulcounter)

Submission status: Accepted

Solution code:
import collections
n = int(input())
A  = list(map(int,input().split()))
A.sort()
co = collections.Counter()
for a in A:
    tag = a//400
    if tag >=8:
        tag = 8
    co[tag] +=1
ans = 0
q = 0
for tag,num in co.items():
    if tag==8:
        q = num
    else:
        ans+=1
print(max(ans,1),ans+q)

Submission status: Accepted

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

b = [val//400 for val in a]
#print(b)
c = set(b)
#print(c)
over=len([val for val in b if val >= 8])
under=[val for val in b if val <8]
if over:
    M=len(set(under))+over
    m=len(set(under))
    if m == 0:
        m=1
else:
    M=len(c)
    m=len(c)
print(m, M)

Submission status: Accepted

Solution code:
N = int(input())
a_list = list(map(int, input().split()))
color_dic = {"gray":False, "brown":False, "green":False, "thin_blue":False, "blue":False, "yellow":False, "orange":False, "red":False, "legend":0}
for i in a_list:
    if 1<=i and i<=399:
       color_dic["gray"] = True
    elif 400<=i and i<=799:
        color_dic["brown"] = True
    elif 800<=i and i<=1199:
        color_dic["green"] = True
    elif 1200<=i and i<=1599:
        color_dic["thin_blue"] = True
    elif 1600<=i and i<=1999:
        color_dic["blue"] = True
    elif 2000<=i and i<=2399:
        color_dic["yellow"] = True
    elif 2400<=i and i<=2799:
        color_dic["orange"] = True
    elif 2800<=i and i<=3199:
        color_dic["red"] = True
    else:
        color_dic["legend"] += 1
ans = 0
for k, v in color_dic.items():
    if k!="legend":
        if v==True:
            ans += 1
ans_min = ans
ans += color_dic["legend"]
if ans_min == 0:
    if color_dic["legend"]>=1:
        ans_min = 1
print(ans_min, ans)

Submission status: Accepted

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

ans = 0
a_1 = 0
a_2 = 0
a_3 = 0
a_4 = 0
a_5 = 0
a_6 = 0
a_7 = 0
a_8 = 0
add = 0
for i in range(n):
    if a[i]  < 400 and a_1 == 0:
        a_1 = 1
        ans +=1
    elif a[i]  < 800 and a[i] >= 400 and a_2 == 0:
        a_2 = 1
        ans +=1
    elif a[i]  < 1200 and a[i] >= 800 and a_3 == 0:
        a_3 = 1
        ans +=1
    elif a[i]  < 1600 and a[i] >= 1200 and a_4 == 0:
        a_4 = 1
        ans +=1
    elif a[i]  < 2000 and a[i] >= 1600 and a_5 == 0:
        a_5 = 1
        ans +=1
    elif a[i]  < 2400 and a[i] >= 2000 and a_6 == 0:
        a_6 = 1
        ans +=1
    elif a[i]  < 2800 and a[i] >= 2400 and a_7 == 0:
        a_7 = 1
        ans +=1
    elif a[i]  < 3200 and a[i] >= 2800 and a_8 == 0:
        a_8 = 1
        ans +=1
    elif a[i] >= 3200:
        add +=1

#if ans == 8:
#    print('8 8')
if ans == 0 and add >=8:
    print('1 8')
elif ans == 0:
    print('1 '+str(add))
#elif ans + add >= 8:
#    print(str(ans)+' 8')
else:
    print(str(ans)+' '+str(ans+add))

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import defaultdict

n = ni()
a = na()
dic = defaultdict(int)

def color(n):
    if n >= 1 and n <= 399:
        return "a"
    if n >= 400 and n <= 799:
        return "b"
    if n >= 800 and n <= 1199:
        return "c"
    if n >= 1200 and n <= 1599:
        return "d"
    if n >= 1600 and n <= 1999:
        return "e"
    if n >= 2000 and n <= 2399:
        return "f"
    if n >= 2400 and n <= 2799:
        return "g"
    if n >= 2800 and n <= 3199:
        return "h"
    return "z"

for i in range(n):
    c = color(a[i])
    if c != "z" and dic[c] >= 1:
        continue
    dic[color(a[i])] += 1

ansmin = max(1, sum(dic.values()) - dic["z"])
ansmax = sum(dic.values())
print(ansmin, ansmax)

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ls = [False] * 8
    cnt = 0
    for i in A:

        if i < 3200:
            ls[i // 400] = True
        else:
            cnt += 1

    if ls.count(True) == 0:
        if cnt == 0:
            minval = 0
        else:
            minval = 1
    else:
        minval = ls.count(True)

    if ls.count(False) <= cnt:
        maxval = 8+cnt-ls.count(False)
    else:
        maxval = 8 - (ls.count(False) - cnt)

    print(minval, maxval)


resolve()

Submission status: Accepted

Solution code:
n = input()
d = [0 for _ in range(9)]
seq = [int(x) for x in input().split()]
for val in seq:
    val = min(val, 3300)
    d[(val // 400)] += 1
a = sum(1 for val in d[:-1] if val > 0)
print(max(1,a), a + d[-1])

Submission status: Accepted

Solution code:
N= int(input())
a_li = list(map(int,input().split()))
a_conv = []
for i in a_li:
    if 1 <= i <= 399:
        a_conv.append(1)
    elif 400 <= i <= 799:
        a_conv.append(2)
    elif 800 <= i <= 1199:
        a_conv.append(3)
    elif 1200 <= i <= 1599:
        a_conv.append(4)
    elif 1600 <= i <= 1999:
        a_conv.append(5)
    elif 2000 <= i <= 2399:
        a_conv.append(6)
    elif 2400 <= i <= 2799:
        a_conv.append(7)
    elif 2800 <= i <= 3199:
        a_conv.append(8)
    elif 3200 <= i:
        a_conv.append(9)
free = a_conv.count(9)
ans_min = 0
ans_max = 0
if free == len(a_conv):
    ans_min = 1
    ans_max = free
else:
    for i in range(1,9):
        if i in a_conv:
            ans_min += 1
    ans_max = ans_min + free
print(ans_min,ans_max)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    color = set()
    free = 0
    for score in a:
        if score < 3200:
            color.add(score//400)
        else:
            free += 1
    print(max(len(color),1), len(color)+free)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    color = [False] * 8
    sub_color = 0
    for score in a:
        for i in range(8):
            if i*400 <= score <= 399+(i*400):
                color[i] = True
        if score >= 3200:
            sub_color += 1
    cnt = len([x for x in color if x])
    if cnt == 0:
        print(1, sub_color, sep=" ")
    else:
        print(cnt, cnt+sub_color, sep=" ")

if __name__ == "__main__":
    main()

Submission status: Accepted

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

color = [False] * 8
cnt = 0
for i in range(N):
    if a[i] <= 399:
        color[0] = True
    elif a[i] <= 799:
        color[1] = True
    elif a[i] <= 1199:
        color[2] = True
    elif a[i] <= 1599:
        color[3] = True
    elif a[i] <= 1999:
        color[4] = True
    elif a[i] <= 2399:
        color[5] = True
    elif a[i] <= 2799:
        color[6] = True
    elif a[i] <= 3199:
        color[7] = True
    elif a[i] <= 4800:
        cnt += 1

print(max(1, sum(color)), sum(color) + cnt)

Submission status: Accepted

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

ls2 = [i // 400 for i in list(s)]
ls3 = [ 8 if i >8 else i for i in ls2]
ls4 = [i for i in ls3 if i  != 8 ]

import collections
c3 = collections.Counter(ls3)
c4 = collections.Counter(ls4)
print(str(max(len(c4),1)) + " " + str(len(c4)+c3[8]))

Submission status: Accepted

Solution code:
n=int(input())

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

memo = [0]*9

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

ans = 0

for i in range(len(memo)):
    if i == 8:
        ex = memo[-1]
    elif memo[i] != 0:
        ans += 1

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

Submission status: Accepted

Solution code:
n = int(input())
array = [int(item) for item in input().split()][:n]
colors = [0, 0, 0, 0, 0, 0, 0, 0, 0]
for rate in array:
    if rate > 0 and rate < 400:
        colors[0] += 1
    elif rate < 800:
        colors[1] += 1
    elif rate < 1200:
        colors[2] += 1
    elif rate < 1600:
        colors[3] += 1
    elif rate < 2000:
        colors[4] += 1
    elif rate < 2400:
        colors[5] += 1
    elif rate < 2800:
        colors[6] += 1
    elif rate < 3200:
        colors[7] += 1
    elif rate <= 4800:
        colors[8] += 1

count = 0
count += 1 if colors[0] > 0 else 0
count += 1 if colors[1] > 0 else 0
count += 1 if colors[2] > 0 else 0
count += 1 if colors[3] > 0 else 0
count += 1 if colors[4] > 0 else 0
count += 1 if colors[5] > 0 else 0
count += 1 if colors[6] > 0 else 0
count += 1 if colors[7] > 0 else 0
min = count
count += colors[8]
max = count
if colors[8] > 0 and min == 0:
    min = 1

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
cc=Counter()
cnt=0
for i in a:
    if i<=399:
        cc['gray']+=1
    elif i<=799:
        cc['brown']+=1
    elif i<=1199:
        cc['green']+=1
    elif i<=1599:
        cc['cyan']+=1
    elif i<=1999:
        cc['blue']+=1
    elif i<=2399:
        cc['yellow']+=1
    elif i<=2799:
        cc['orange']+=1
    elif i<=3199:
        cc['red']+=1
    else:
        cnt+=1
mini=len(cc)
if len(cc)==0:
    mini=1
else:
    mini=len(cc)
maxi=len(cc)+cnt
print(mini,maxi)

Submission status: Accepted

Solution code:
input();l=[0]*8;c=0
for i in map(int,input().split()):
  i//=400
  if i<8: l[i]=1
  else: c+=1
s=sum(l);print(max(s,1),s+c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

for rate in a:
    if(rate<=399):
        color[0]+=1
    elif(rate<=799):
        color[1]+=1
    elif(rate<=1199):
        color[7]+=1
    elif(rate<=1599):
        color[2]+=1
    elif(rate<=1999):
        color[3]+=1
    elif(rate<=2399):
        color[4]+=1
    elif(rate<=2799):
        color[5]+=1
    elif(rate<=3199):
        color[6]+=1
    else:
        free+=1

if(free == N ):
    print(1,free)
else:
    ans=len([i for i in color if i != 0])
    print(ans,ans+free)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
lst=[0]*8
num=0
for i in range(n):
  if 3200<=a[i]:
    num+=1
  for j in range(8):
    if 400*j<=a[i]<400*(j+1):
      if lst[j]==0:
        lst[j]+=1

print(*[max(1,sum(lst)),sum(lst)+num])

Submission status: Accepted

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

rate = [False] * 9

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

not_free_rate = rate.count('T')
free_rate = rate[8]


if not_free_rate == 0:
    min_num = 1
else:
    min_num = not_free_rate


print(min_num, not_free_rate+free_rate)

Submission status: Accepted

Solution code:
def ratecolor(List):
    ratebar = [0]*8
    for r in List:
        if r>=1 and r<400:
            ratebar[0]=1
        elif r>=400 and r<800:
            ratebar[1]=1
        elif r>=800 and r<1200:
            ratebar[2]=1
        elif r>=1200 and r<1600:
            ratebar[3]=1
        elif r>=1600 and r<2000:
            ratebar[4]=1
        elif r>=2000 and r<2400:
            ratebar[5]=1
        elif r>=2400 and r<2800:
            ratebar[6]=1
        else:
            ratebar[7]=1
        
    l = len([i for i in ratebar if i>=1])
    
    return l
    

N = int(input())
A = [int(i) for i in input().split(" ")]
_3200 = [i for i in A if i<3200]
Upper3200 = len([i for i in A if i>=3200])

n = ratecolor(_3200)

if n==0:
    print("{} {}".format(1,Upper3200))
else:
    print("{} {}".format(n,n+Upper3200))

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
count=0
for i in range(0,2801,400):
  for j in range(N):
    if i<=a[j]<=399+i:
      count+=1
      break
c=0
for i in range(N):
  if 3200<=a[i]:
    c+=1

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

Submission status: Accepted

Solution code:
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
#from scipy.misc import comb

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

cnt = [0]*9
for a in A:
    for i in range(9):
        if i == 8: cnt[i] += 1
        else:
            if a < 400*(i+1):
                cnt[i] = 1
                break

Min = max(sum(cnt[:8]),1)
Max = sum(cnt[:8]) + cnt[8]

print(Min, Max)

Submission status: Accepted

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

color = set()
flg = 0
for ai in a:
    if ai // 400 < 8:
        color.add(ai // 400)
    else:
        flg += 1
        
if len(color) == 0:
    print(1, len(color) + flg)
else:
    print(len(color), len(color) + flg)

Submission status: Accepted

Solution code:
from bisect import bisect_left
import numpy as np

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

border = np.arange(399, 3200, 400)
cnt = np.zeros(len(border) + 1, dtype=np.int)
for i in a:
    cnt[bisect_left(border, i)] += 1

k = np.count_nonzero(cnt[:-1])
print(k, k + cnt[-1]) if k != 0 else print(1, cnt[-1])

Submission status: Accepted

Solution code:
import numpy as np

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

border = list(range(400, 3201, 400))
cnt = [0] * (len(border) + 1)
for aa in a:
    for i, k in enumerate(border):
        if aa < k:
            cnt[i] += 1
            break
    else:
        cnt[i+1] += 1

k = np.count_nonzero(cnt[:-1])
print(k, k + cnt[-1]) if k != 0 else print(1, cnt[-1])

Submission status: Accepted

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

border = list(range(400, 3201, 400))
cnt = [0] * (len(border) + 1)
for aa in a:
    for i, k in enumerate(border):
        if aa < k:
            cnt[i] += 1
            break
    else:
        cnt[i+1] += 1

k = len([i for i in cnt[:-1] if i > 0])
print(k, k + cnt[-1]) if k != 0 else print(1, cnt[-1])

Submission status: Accepted

Solution code:
from bisect import bisect_left
import numpy as np

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

border = np.arange(399, 3200, 400)
cnt = [0] * (len(border) + 1)
for i in a:
    cnt[bisect_left(border, i)] += 1

k = np.count_nonzero(cnt[:-1])
print(k, k + cnt[-1]) if k != 0 else print(1, cnt[-1])

Submission status: Accepted

Solution code:

import math
import itertools
import statistics
#import collections
n = int(input())
a = list(map(int, input().split()))
#a.sort()

#rate = [400, 800, 1200, 1600, 2000, 24000, 2800, 3200]
count = [0]*9
for i in range(n):
    if a[i] < 400:
        count[0] += 1
    elif a[i] < 800:
        count[1] += 1
    elif a[i] < 1200:
        count[2] += 1
    elif a[i] < 1600:
        count[3] += 1
    elif a[i] < 2000:
        count[4] += 1
    elif a[i] < 2400:
        count[5] += 1
    elif a[i] < 2800:
        count[6] +=1
    elif a[i] < 3200:
        count[7] +=1
    else:
        count[8] += 1


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


ans_max = ans+count[8]

"""
if ans+count[8] <= 8:
    ans_max = ans+count[8]
else:
    ans_max = 8
"""
   
if ans==0:
    ans = 1

print(str(ans)+" "+str(ans_max))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from bisect import bisect_right
from collections import Counter

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

rate = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]

idx = []

for a in A:
    idx.append(bisect_right(rate, a))

# print(idx)

c = Counter(idx)



min_c = len(c.keys())
if (7 in c.keys()) and (8 in c.keys()):
    min_c -= 1
max_c = 0
for i in range(8):
    if i in c.keys():
        max_c += 1
if 8 in c.keys():
    # min_c -= 1
    # max_c += min(8, c[8])
    max_c += c[8]
    # if max_c > 8:
    #     max_c = 8

print(min_c, max_c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    _ = int(input())
    a = list(map(int, input().split()))
    
    counter = [0] * 9
    for ai in a:
        counter[min(8, ai // 400)] += 1
    
    ans_min = 0
    for i in range(8):
        if 0 < counter[i]:
            ans_min += 1
    
    ans_max = ans_min + counter[-1]
    if ans_min == 0:
        ans_min = 1
    print(ans_min, ans_max)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

for p in a:
  if p<=399:
    con.add("灰")
  elif p<=799:
    con.add("茶")
  elif p<=1199:
    con.add("緑")
  elif p<=1599:
    con.add("水")
  elif p<=1999:
    con.add("青")
  elif p<=2399:
    con.add("黄")
  elif p<=2799:
    con.add("橙")
  elif p<=3199:
    con.add("赤")
  else:
    wild +=1
    
mini=max(1,len(con))
maxi=len(con)+wild
print(mini,maxi)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
C = [a // 400 for a in A]
mini = sum([1 for c in range(8) if c in C])
print(max(mini, 1), mini + sum([1 for c in C if c >= 8]))

Submission status: Accepted

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

scores = [0, 0, 0, 0, 0, 0, 0, 0]
x = [0]

def evaluation(list):
    for i in list:
        if 0 <= i <= 399:
            scores[0] = 1
        elif 400 <= i <= 799:
            scores[1] = 1
        elif 800 <= i <= 1199:
            scores[2] = 1
        elif 1200 <= i <= 1599:
            scores[3] = 1
        elif 1600 <= i <= 1999:
            scores[4] = 1
        elif 2000 <= i <= 2399:
            scores[5] = 1
        elif 2400 <= i <= 2799:
            scores[6] = 1
        elif 2800 <= i <= 3199:
            scores[7] = 1
        else:
            x.append(1)

evaluation(l)

y = sum(scores)
z = sum(x)

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

Submission status: Accepted

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

scores = [0, 0, 0, 0, 0, 0, 0, 0]
x = 0

def evaluation(list):
    for i in list:
        if 0 <= i <= 399:
            scores[0] = 1
        elif 400 <= i <= 799:
            scores[1] = 1
        elif 800 <= i <= 1199:
            scores[2] = 1
        elif 1200 <= i <= 1599:
            scores[3] = 1
        elif 1600 <= i <= 1999:
            scores[4] = 1
        elif 2000 <= i <= 2399:
            scores[5] = 1
        elif 2400 <= i <= 2799:
            scores[6] = 1
        elif 2800 <= i <= 3199:
            scores[7] = 1

for j in range(n):
    if l[j] >= 3200:
        x += 1

evaluation(l)
y = sum(scores)

if n==1:
    print(1,1)
else:
    print(max(1, y), y + x)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
b = [0 for i in range(9)]
red = 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:
		red += 1
c = 0
for i in b:
	if i > 0:
		c += 1
if c == 0:
	mn = 1
else:
	mn = c
mx = c + red
print (mn, mx)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    a[i] = a[i] // 400
    if a[i] >= 8:
        a[i] = 8
non_free = [i for i in a if i != 8]
if len(non_free) == 0:
    min_ans = 1
    max_ans = a.count(8)
else:
    min_ans = len(set(non_free))
    max_ans = len(set(non_free)) + a.count(8)
print(min_ans, max_ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
b = [0 for i in range(9)]
red = 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:
		red += 1
c = 0
for i in b:
	if i > 0:
		c += 1
if c == 0:
	mn = 1
else:
	mn = c
mx = c + red
print (mn, mx)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
r=[0]*8
f=0

for i in range(n):
    if(a[i]>=3200):
        f+=1
    else:
        r[a[i]//400]=1;

c=sum(r)

print(1 if(c==0) else c,end=" ")
print(f+c)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
w = [0 for i in range(8)]
count = 0
sup = 0
for i in a:
    if i < 3200 and w[i//400]==0:
        count+=1
        w[i//400] += 1
    elif i >= 3200:
        sup += 1
if count == 0:
    print(1,sup)
elif sup == 0:
    print(count,count)
else:
    b= count+sup
    print(count,b)

Submission status: Accepted

Solution code:
N = int(input())
check = [False]*8
over = 0
a_s = list(map(int, input().split()))
for a in a_s:
  if 1 <=a<=399:
    check[0] = True
  elif 400<=a<=799:
    check[1]=True
  elif 800<=a<=1119:
    check[2]=True
  elif 1200<=a<=1599:
    check[3]=True
  elif 1600<=a<=1999:
    check[4]=True
  elif 2000<=a<=2399:
    check[5]=True
  elif 2400<=a<=2799:
    check[6]=True
  elif 2800<=a<=3199:
    check[7]=True
  if a >= 3200:
    over += 1
mn = check.count(True)

if mn == 0:
  print(1, mn+over)
else:
  print(mn, mn+over)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
a = LIST()
a.sort()
arr = [0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
r = -1
for i in range(len(arr)):
    if a[0] < arr[i]:
        r = i
        break
ans = 1 if r != -1 else 0
ans2 = 0
for i in range(n):
    if a[i] >= arr[r]:
        r = -1
        for j in range(len(arr)):
            if a[i] < arr[j]:
                r = j
                break
        if r == -1:
            ans2 += 1
        else:
            ans += 1
print(ans if ans > 0 else 1, ans + ans2)

Submission status: Accepted

Solution code:
num = int(input())
list = [int(x) for x in input().split()]

count = 0
any = 0

color = []

for i in range(num):
    if 1 <= list[i] < 400:
        color.append("gray")
    elif 400 <= list[i] < 800:
        color.append("brown")
    elif 800 <= list[i] < 1200:
        color.append("green")
    elif 1200 <= list[i] < 1600:
        color.append("sky")
    elif 1600 <= list[i] < 2000:
        color.append("blue")
    elif 2000 <= list[i] < 2400:
        color.append("yellow")
    elif 2400 <= list[i] < 2800:
        color.append("orange")
    elif 2800 <= list[i] < 3200:
        color.append("red")
    else:
        color.append("any")



if "gray" in color:
    count += 1
else:
    None


if "brown" in color:
    count += 1
else:
    None


if "green" in color:
    count += 1
else:
    None


if "sky" in color:
    count += 1
else:
    None


if "blue" in color:
    count += 1
else:
    None


if "yellow" in color:
    count += 1
else:
    None


if "orange" in color:
    count += 1
else:
    None


if "red" in color:
    count += 1
else:
    None



if count == 0:
    print("1",color.count("any"))
else:
    print(count,count+color.count("any"))