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()))
s = []
k = 0
l = 0

for i in range(N):
	if a[i] <= 399:
		s.append('a')
	elif a[i] <= 799:
		s.append('b')
	elif a[i] <= 1199:
		s.append('c')
	elif a[i] <= 1599:
		s.append('d')
	elif a[i] <= 1999:
		s.append('e')
	elif a[i] <= 2399:
		s.append('f')
	elif a[i] <= 2799:
		s.append('g')
	elif a[i] <= 3199:
		s.append('h')
	else:
		k += 1

if s.count("a") != 0:
	l += 1

if s.count("b") != 0:
	l += 1
	
if s.count("c") != 0:
	l += 1

if s.count("d") != 0:
	l += 1

if s.count("e") != 0:
	l += 1
	
if s.count("f") != 0:
	l += 1

if s.count("g") != 0:
	l += 1

if s.count("h") != 0:
	l += 1
	
m = k + l

if l == 0:
	print(1,m)
else:
	print(l,m)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    a = list(map(int, input().split()))

    # 0:gray 1:brown 2:green ...... 7:red
    colors_count = [0 for i in range(8)]
    super_count = 0
    for score in a:
        if int(score / 400) == 0:
            colors_count[0] += 1
        elif int(score / 400) == 1:
            colors_count[1] += 1
        elif int(score / 400) == 2:
            colors_count[2] += 1
        elif int(score / 400) == 3:
            colors_count[3] += 1
        elif int(score / 400) == 4:
            colors_count[4] += 1
        elif int(score / 400) == 5:
            colors_count[5] += 1
        elif int(score / 400) == 6:
            colors_count[6] += 1
        elif int(score / 400) == 7:
            colors_count[7] += 1
        else:
            super_count += 1

    # print(colors_count)

    # colors_count で0ではないとこの数
    not_zero_count = 0
    for num in colors_count:
        if num != 0:
            not_zero_count += 1

    if not_zero_count == 0:
        ans_min = 1
        # ans_max = super_count if super_count <= 8 else 8
        ans_max = super_count
    else:
        ans_min = not_zero_count
        # ans_max = not_zero_count + super_count if (not_zero_count + super_count) <= 8 else 8
        ans_max = not_zero_count + super_count

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

Submission status: Accepted

Solution code:
n = int(input())
a_list = list(map(int,input().split()))
color_vari = set()
over3200 = 0
for x in a_list:
	if x >= 3200:
		over3200 += 1

	else:
		color_vari.add(x // 400)
if len(color_vari) == 0:
	print(1,over3200)
else:
	print(len(color_vari),len(color_vari)+over3200)

Submission status: Accepted

Solution code:
N = int(input())
data = input().split()
data = data[:N]

color = [0, 0, 0, 0, 0, 0, 0, 0]
count = 0

for i in data:
	i = int(i)
	if(i< 400):				#灰色
		if(color[0] == 0):
			color[0] = 1
	elif(i < 800):			#茶色
		if(color[1] == 0):
			color[1] = 1
	elif(i < 1200):			#緑色
		if(color[2] == 0):
			color[2] = 1
	elif(i < 1600):			#水色
		if(color[3] == 0):
			color[3] = 1
	elif(i < 2000):			#青色
		if(color[4] == 0):
			color[4] = 1
	elif(i < 2400):			#黄色
		if(color[5] == 0):
			color[5] = 1
	elif(i < 2800):			#橙色
		if(color[6] == 0):
			color[6] = 1
	elif(i < 3200):			#赤色
		if(color[7] == 0):
			color[7] = 1
	else:					#3200以上
		count += 1

flag = sum(color)
if(flag == 0):
	min = 1
	max = count
else:
	min = flag
	max = min + count

print(min, max)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = input()
a = map(int, raw_input().split())
a = sorted(a)

check = [0]*8
ex = 0
for i in range(n):
    if(a[i]<3200):
        check[a[i]/400] = 1
    else:
        ex += 1
l = max(sum(check),1)
h = sum(check)+ex
print(str(l)+' '+str(h))

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
a_str = input().split()
a_num = [int(a) for a in a_str]
a_array = np.array(a_num)

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

count = 0

for i in range(8):
    if len(a_array[np.where((a_array>=rate_list[i])&(a_array<rate_list[i+1]))]):
        count += 1

if count == 0:
    min_count = 1
else:
    min_count = count

count += len(a_array[a_array>=rate_list[8]])
max_count = count

print(str(min_count)+" "+str(max_count))

Submission status: Accepted

Solution code:
n=int(raw_input())
a=map(int,raw_input().split())
c=[0]*8
mx=0
for i in xrange(n):
    if 1<=a[i]<400:
        c[0]=1
    elif 400<=a[i]<800:
        c[1]=1
    elif 800<=a[i]<1200:
        c[2]=1
    elif 1200<=a[i]<1600:
        c[3]=1
    elif 1600<=a[i]<2000:
        c[4]=1
    elif 2000<=a[i]<2400:
        c[5]=1
    elif 2400<=a[i]<2800:
        c[6]=1
    elif 2800<=a[i]<3200:
        c[7]=1
    else:
        mx+=1
print max(1,sum(c)),sum(c)+mx

Submission status: Accepted

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

rank = [False] * 8

count = 0
for i in range(N):
  if 3200 <= a[i]:
    count += 1
  else:
    rank[int(a[i]/400)] = True

minimum = rank.count(True)
maximum = minimum + count
if minimum == 0:
  minimum = 1
print minimum, maximum

Submission status: Accepted

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

res_min = 0
res_max = 0

g = list(filter(lambda x: x <= 399, a))
br = list(filter(lambda x: 400 <= x <= 799, a))
gr = list(filter(lambda x: 800 <= x <= 1199, a))
s = list(filter(lambda x: 1200 <= x <= 1599, a))
bl = list(filter(lambda x: 1600 <= x <= 1999, a))
y = list(filter(lambda x: 2000 <= x <= 2399, a))
o = list(filter(lambda x: 2400 <= x <= 2799, a))
r = list(filter(lambda x: 2800 <= x <= 3199, a))
t = list(filter(lambda x: 3200 <= x, a))

c_list = [g, br, gr, s, bl, y, o, r]

for c in c_list:
    if len(c) != 0:
        res_min += 1
        res_max += 1

if res_min == 0:
    res_min += 1
res_max += len(t)


print(res_min, res_max)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from collections import Counter
N = int(input())
a = [int(n)//400 for n in input().split()]
counter = Counter(a)

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

rainbow_coder = 0
for i in range(8, 13):
    rainbow_coder += counter[i]

print("{} {}".format(max(1, colors), colors+rainbow_coder))

Submission status: Accepted

Solution code:
N = int(raw_input())
a = map(int, raw_input().split())
b = []
cnt = 0
for i in range(0, N):
    if a[i] / 400 >= 8:
        cnt += 1
    else:
        b.append(a[i]/400)
b = set(b)

flag = 1
for x in a:
    if x >= 3200:
        flag = 0
    else:
        flag = 1
        break
if flag:
    print len(b)
else:
    print 1
print len(b) + cnt

Submission status: Accepted

Solution code:
N=int(raw_input())
a=map(int,raw_input().split())
c=[0,0,0,0,0,0,0,0]
m=0
for i in range(N):
    b =a[i]/ 400
    if b < 8:
        c[b]+=1
    else:
        m+=1


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

mi=ans
if mi==0:
    mi=1
ma=ans+m
print mi,ma

Submission status: Accepted

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

gray, tya, midori, mizu, ao, ki, daidai, aka, joker = 0, 0, 0, 0, 0, 0, 0, 0, 0

for i in a:
    if 1 <= i <= 399:
        gray = 1
    elif 400 <= i <= 799:
        tya = 1
    elif 800 <= i <= 1199:
        midori = 1
    elif 1200 <= i <= 1599:
        mizu = 1
    elif 1600 <= i <= 1999:
        ao = 1
    elif 2000 <= i <= 2399:
        ki = 1
    elif 2400 <= i <= 2799:
        daidai = 1
    elif 2800 <= i <= 3199:
        aka = 1
    elif 3200 <= i:
        joker += 1

mini = gray+tya+midori+mizu+ao+ki+daidai+aka
maxi = mini + joker

if mini == 0 and joker != 0:
    mini = 1

print mini, maxi

Submission status: Accepted

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

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

mn = sum(kinds)
if mn == 0:
    mn = 1
    mx = wild
else:
    mx = mn + wild
print mn,mx

Submission status: Accepted

Solution code:
N = int(input())
R = [1,400,800,1200,1600,2000,2400,2800,3200,4801]
r = [0] * 10
A = list(map(int,input().split()))
for a in A:
	m = 0
	M = 9
	while True:
		n = (m + M) // 2
		if a < R[n]:
			M = n
		elif a >= R[n + 1]:
			m = n
		else:
			break
	r[n] += 1
cnt = 0
for i in r[:-2]:
	if i > 0:
		cnt += 1
if cnt == 0:
	max_cnt = r[8]
	cnt = 1
else:
	max_cnt = cnt + r[8]
print(cnt,max_cnt)

Submission status: Accepted

Solution code:



conds = (
    [lambda x: x <= 399, False],
    [lambda x: x <= 799, False],
    [lambda x: x <= 1199, False],
    [lambda x: x <= 1599, False],
    [lambda x: x <= 1999, False],
    [lambda x: x <= 2399, False],
    [lambda x: x <= 2799, False],
    [lambda x: x <= 3199, False],
)


def main():
    n = int(raw_input())
    xs = [int(x) for x in raw_input().split()]

    others = 0
    for x in xs:
        for cond in conds:
            if cond[0](x):
                cond[1] = True
                break
        else:
            others += 1

    s = sum(1 for c, t in conds if t)

    print s if s else 1,
    print s + others


main()

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
R = [0]*9
for r in a:
  rr = r//400
  if rr < 8:
    R[rr] = 1
  else:
    R[8] += 1
s2 = sum(R)
s1 = max(1,s2-R[8])
print(s1,s2)

Submission status: Accepted

Solution code:
def whichcolor(n):
	if n < 3200:
		return n / 400
	else:
		return 8

def countnotzero(lst):
	cnt = 0
	for i in range(0, len(lst)):
		if lst[i] != 0:
			cnt += 1
	return cnt

n = int(raw_input())
inpt = map(int, raw_input().split())

color = [0, 0, 0, 0, 0, 0, 0, 0]
almighty = 0

for i in range(0, n):
	c = whichcolor(inpt[i])
	if c == 8:
		almighty += 1
	else:
		color[c] += 1

nzro = countnotzero(color)
min = nzro
if min == 0:
	min = 1
max = nzro + almighty
print str(min) + ' ' + str(max)

Submission status: Accepted

Solution code:
N = int(input())
Rates = list(map(int, input().split()))
Colors = []
Rainbow = 0

for Rate in Rates:
    if Rate < 400:
        Colors.append("灰色")
    elif Rate < 800:
        Colors.append("茶色")
    elif Rate < 1200:
        Colors.append("緑色")
    elif Rate < 1600:
        Colors.append("水色")
    elif Rate < 2000:
        Colors.append("青色")
    elif Rate < 2400:
        Colors.append("黄色")
    elif Rate < 2800:
        Colors.append("橙色")
    elif Rate < 3200:
        Colors.append("赤色")
    else:
        Rainbow += 1

Color = set(Colors)
if len(Color) != 0:
    print(len(Color) , len(Color) + Rainbow)
else:
    print(1 , len(Color) + Rainbow)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict

def main():
    n = int(sys.stdin.readline())

    line = sys.stdin.readline()
    lst = line.split()

    cnt_dic = defaultdict(int)

    #400で割ったときの商が0,1,2,3,4,5,6,7
    #8以上は、自由に色を決められる

    for ch in lst:
        rating = int(ch)
        n = rating // 400
        if n <= 7:
            cnt_dic[n] += 1
        else:
            cnt_dic[8] += 1

    ans_max = 0
    ans_min = 0
    for i in range(0,8):
        if cnt_dic[i] > 0:
            ans_max += 1
            ans_min += 1

    if cnt_dic[8] > 0:
        ans_max += cnt_dic[8]
        if ans_min == 0:
            ans_min += 1

    print("%d %d" % (ans_min, ans_max))
    return 0

if __name__ == '__main__':
    sys.exit(main())

Submission status: Accepted

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

a.sort()

minc=0
maxc=0

for i in range(1,9):
    if len([x for x in a if x<400*i and x>=400*(i-1)]):
        minc+=1

if minc:
    maxc = minc + len([x for x in a if x>=400*(9-1)])
else:
    maxc = len([x for x in a if x>=400*(9-1)])
    minc = 1

print(str(minc) + ' ' + str(maxc))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
st = [0] * 10
extra = 0
for x in a:
    if x >= 3200:
        extra += 1
        continue
    for i in range(0, 2801, 400):
        if i <= x <= i + 399:
            st[i // 400] = 1
            break
ans = sum(st)
print(max(ans, 1), ans + extra)

Submission status: Accepted

Solution code:
n = int(raw_input())
rate = map(int, raw_input().split())
num = [0]*9

cunt = 0
for item in rate:
    if item < 3200:
        if item < 400:
            num[0] = 1
        elif item < 800:
            num[1] = 1
        elif item < 1200:
            num[2] = 1
        elif item < 1600:
            num[3] = 1
        elif item < 2000:
            num[4] = 1
        elif item < 2400:
            num[5] = 1
        elif item < 2800:
            num[6] = 1
        elif item < 3200:
            num[7] = 1
    else:
        num[8] += 1
if sum(num[:-1]) == 0:
    print 1, sum(num)
else:
    print sum(num[:-1]), sum(num)

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
ans=0
for i in a:
    if i <400:
        c[0] += 1
    elif i>=400 and i<800:
        c[1] += 1
    elif i>=800 and i<1200:
        c[2] += 1
    elif i>=1200 and i<1600:
        c[3] += 1
    elif i>=1600 and i<2000:
        c[4] += 1
    elif i>=2000 and i<2400:
        c[5] += 1
    elif i>=2400 and i<2800:
        c[6] += 1
    elif i>=2800 and i<3200:
        c[7] += 1
    else:
        r += 1
for i in c:
    if i>0:
        ans += 1

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

Submission status: Accepted

Solution code:
dic={}
n=int(input())
data=list(map(int,input().split()))
ans=0
for i in range(n):
    if data[i]>3199:
        ans+=1
    elif data[i]//400 not in dic:
        dic[data[i]//400]=1
if len(dic)==0:
    print(1,ans)
else:
    print(len(dic),ans+len(dic))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
d = {'gray': 0, 'green': 0, 'cyan': 0, 'red': 0, 'brown': 0, 'blue': 0, 'yellow': 0, 'orange': 0, 'above':0}
for i in a:
    if i <= 399:
        d['gray'] += 1
    elif i <=799:
        d['brown'] += 1
    elif i <= 1199:
        d['green'] += 1
    elif i <= 1599:
        d['cyan'] += 1
    elif i <= 1999:
        d['blue'] += 1
    elif i <= 2399:
        d['yellow'] += 1
    elif i <= 2799:
        d['orange'] += 1
    elif i <= 3199:
        d['red'] += 1
    else:
        d['above'] += 1
res1 = 0
res2 = 0
for i in d.items():
    if i[0] != 'above' and i[1] > 0:
        res1 += 1
        res2 += 1
print(max(1, res1), res2 + d['above'])

Submission status: Accepted

Solution code:
#! -*- coding:utf-8 -*-
n = int(input())
a = list(map(int,input().split()))
arr = []
count = 0
for i in range(len(a)):
    if a[i] <= 3199:
        arr.append(a[i] // 400)
    else:
        count += 1
if len(set(arr)) != 0:
    print(len(set(arr)), len(set(arr)) + count,sep = ' ')
else:
    print(1, count,sep = ' ')

Submission status: Accepted

Solution code:
import math
n = int(input())
a = list(map(int,input().split(" ")))
pts = [0]*10
for p in a:
	ca = int(math.floor(p/400))
	if ca>7:
		ca = 8
	pts[ca] +=1
	
min = 0
for p in pts:
	if p>0:
		min+=1

if pts[8]>0:
	if min>1:
		min -=1
		max = min + pts[8]
	else:
		max = pts[8]
else:
	max = min


print(str(min)+" "+str(max))

Submission status: Accepted

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

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

mn = 0
mx = 0
for i,j in enumerate(l) :
	if i < 8 :
		mn += min(1,j)
	else :
		mx = mn + j
print(max(mn,1), mx)

Submission status: Accepted

Solution code:
def color(x):
	if x < 400:
		return "grey"
	
	if x < 800:
		return "brown"

	if x < 1200:
		return "green"

	if x < 1600:
		return "cyan"

	if x < 2000:
		return "blue"

	if x < 2400:
		return "yellow"

	if x < 2800:
		return "orange"

	if x < 3200:
		return "red"

	return "x"

colors = ["grey", "brown", "green", "cyan", "blue", "yellow", "orange", "red"]
C = []

n = int(input())

c = 0

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

for a in A:
	if(color(a) == "x"):
		c += 1
	else:
		C.append(color(a))

C = list(set(C))

m = len(C) + c

if(len(C) == 0):
	C.append("x")

print("{} {}".format(len(C), m))

Submission status: Accepted

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

import collections

def color(r):
    for i, (p, q) in enumerate([
            (1, 399),
            (400, 799),
            (800, 1199),
            (1200, 1599),
            (1600, 1999),
            (2000, 2399),
            (2400, 2799),
            (2800, 3199),
            (3200, 4800)
    ]):
        if p <= r <= q:
            return i

input()
a = collections.Counter([color(int(x)) for x in input().split()])
m = len(a) - (1 if 8 in a and len(a) > 1 else 0)
print(m, m + a[8] - (1 if 8 in a and len(a) == 1 else 0))

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
b=[0]*9
for i in range(N):
  if a[i]<400:
    b[0]=1
  elif a[i]<800:
    b[1]=1
  elif a[i]<1200:
    b[2]=1
  elif a[i]<1600:
    b[3]=1
  elif a[i]<2000:
    b[4]=1
  elif a[i]<2400:
    b[5]=1
  elif a[i]<2800:
    b[6]=1
  elif a[i]<3200:
    b[7]=1
  else:
    b[8]+=1
if b[8]==N:#全員がつよい!
  print(1,min(N,8))
else:
  Min=0
  Max=0
  for i in range(8):
    Min+=b[i]
  print(Min,min(N,Min+b[8]))

Submission status: Accepted

Solution code:
'''
    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
'''
b = [0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
u = [0] * 8
import sys
n = map(int, sys.stdin.readline().split())
a = map(int, sys.stdin.readline().split())
res = 1
target = 0
for c in a:
  for i in range (len(b) - 1):
    if b[i] <= c < b[i+1]:
      u[i] = 1
  if c >= 3200:
    target += 1
print max(1, sum(u)), sum(u) + target

Submission status: Accepted

Solution code:
input()
a = map(int, raw_input().split())
S = set()
c = 0
for t in a:
    if t>=3200:
        c += 1
    else:
        S.add(t/400)
print max(1, len(S)), len(S)+c

Submission status: Accepted

Solution code:
rates = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
n = input()
A = map(int, raw_input().split())
cnts = [0]*9
for a in A:
    for i, r in enumerate(rates):
        if a < r:
            cnts[i] = 1
            break
    else:
        cnts[-1] += 1
mi = max(sum(cnts[:-1]), 1)
ma = sum(cnts)
print mi, ma

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
cnt = [0 for i in range(100)]
for i in range(n):
    cnt[a[i]//400] += 1
mi = max(1, sum([1 if cnt[i]>0 else 0 for i in range(8)]))
ma = sum([1 if cnt[i]>0 else 0 for i in range(8)]) + sum(cnt[8:])
print(mi, ma)

Submission status: Accepted

Solution code:
from collections import defaultdict

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

s=defaultdict(int)
wild=0
for x in a:
    if x>=3200:
        wild+=1
    else:
        s[x//400]+=1

mn=len(s)+(len(s)==0)
mx=len(s)+wild

print(mn,mx)

Submission status: Accepted

Solution code:
pts = [
    399,
    799,
    1199,
    1599,
    1999,
    2399,
    2799,
    3199,
]
n = int(raw_input())

a = [int(_) for _ in raw_input().split()]
m = 0
d = {}
for ai in a:
    for p in pts:
        if ai <= p:
            d[p] = True
            break
    else:
        m += 1

l = len(d)
print max(l, 1), l + m

Submission status: Accepted

Solution code:
N = input()
A = map(int, raw_input().split())
A.sort()
cnt = [0 for _ in xrange(9)]
for a in A:
    cnt[min(a/400, 8)] += 1

m = 0
for c in cnt[:-1]:
    if c > 0:
        m += 1
if m == 0 and cnt[:-1] > 0:
    print 1, cnt[-1]
else:
    print m, m + cnt[-1]

Submission status: Accepted

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

def color(a):
    if a < 400:
        return 1
    elif a < 800:
        return 2
    elif a < 1200:
        return 3
    elif a < 1600:
        return 4
    elif a < 2000:
        return 5
    elif a < 2400:
        return 6
    elif a < 2800:
        return 7
    elif a < 3200:
        return 8
    else:
        return 0

freq = [0] * 9
for a in As:
    freq[color(a)] += 1

cum = 0
for c in freq[1:]:
    if c: cum += 1
an = freq[0]

if cum == 0:
    print(1, an)
else:
    print(cum, cum + an)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
a = na()
f = [0]*8
sp = 0
for v in a:
    if v >= 3200:
        sp += 1
    else:
        f[v//400] = 1
if sum(f) > 0:
    print("{} {}".format(sum(f), sum(f)+sp))
else:
    print("{} {}".format(sum(f)+min(sp,1), sum(f)+sp))

Submission status: Runtime Error

Solution code:
#!/usr/local/bin/python3
# https://atcoder.jp/contests/abc064/tasks/abc064_c


def check(a):
    if 1 <= a < 400:
        return 0
    elif 400 <= a < 799:
        return 1
    elif 800 <= a < 1199:
        return 2
    elif 1200 <= a < 1599:
        return 3
    elif 1600 <= a < 1999:
        return 4
    elif 2000 <= a < 2399:
        return 5
    elif 2400 <= a < 2799:
        return 6
    elif 2800 <= a < 3199:
        return 7
    elif 3200 <= a:
        return 8


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

ratings = [
    '1-399', '400-799', '800-1199', '1200-1599', '1600-1999',
    '2000-2399', '2400-2799', '2800-3199', '3200-']
d = {r: 0 for r in ratings}

for a in A:
    d[ratings[check(a)]] += 1

ans = 0
for k, v in d.items():
    if k != '3200-' and v != 0:
        ans += 1

top = d['3200-']
if top == 0:
    print(ans, ans)
elif ans == 0:
    print(1, min(8, top))
else:
    print(ans, ans+min(8, top))

Submission status: Runtime Error

Solution code:
import numpy as np
N,*A=map(int,open(0).read().split())
A=(np.array(A)//400).astype("int32")

color_num=0

colors=np.zeros(9)

for a in A:
    colors[min(a,9)]+=1
c=np.count_nonzero(colors[:-1])

min_color_num = 1 if (c==0 and colors[-1]>0) else c
max_color_num = min(8,c+max(int(colors[-1]),0))

print(min_color_num,max_color_num)

Submission status: Runtime Error

Solution code:
import numpy as np
N,*A=map(int,open(0).read().split())
A=(np.array(A)//400).astype("int32")

color_num=0

colors=np.zeros(9)

for a in A:
  colors[a]+=1

c=np.count_nonzero(colors[:-1])

min_color_num = 1 if (c==0 and colors[-1]>0) else c
max_color_num = min(8,c+max(int(colors[-1]),0))

print(min_color_num,max_color_num)

Submission status: Runtime Error

Solution code:
import numpy as np
N,*A=map(int,open(0).read().split())
A=(np.array(A)//400).astype("int32")

color_num=0

colors=np.zeros(9)

for a in A:
  colors[a]+=1

c=np.count_nonzero(colors[:8])

min_color_num = 1 if (c==0 and colors[-1]>0) else c
max_color_num = min(8,c+max(int(colors[-1]),0))

print(min_color_num,max_color_num)

Submission status: Runtime Error

Solution code:
n = int(input())

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

c = [0]*9
for i in a:
  t = i // 400
  if t < 8:
    c[t] = 1
  else:
    c[8] += 1
cmin = max(sum(c[:-1]), min(c[8], 1))
cmax = min(sum(c))
print(cmin, cmax)

Submission status: Runtime Error

Solution code:
n = int(input())

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

c = [0]*9
for i in a:
  t = i // 400
  if t < 8:
    c[t] = 1
  elif t >= 8:
    c[t] += 1
cmin = max(sum(c[:-1]), min(c[8], 1))
cmax = min(sum(c[:-1]) + c[8], 8)
print(cmin, cmax)

Submission status: Runtime Error

Solution code:
N = int(input())
N_List = list(map(int,input().split()))
NR_List = [i // 400 for i in N_List]
Number_NRD = len(set([i for i in NR_List if i < 8]))
Number_NRU = len([i for i in NR_List if i >= 8])
max_p= (Number_NRD + Number_NRU,8)[Number_NRD +Number_NRU>=8]
min_P= (Number_NRD,1)[Number_NRD == 0]
print(str(min_p) + " " + str(max_p))

Submission status: Runtime Error

Solution code:
N = int(input())
N_List = list(map(int,input().split()))
NR_List = [i // 400 for i in N_List]
Number_NRD = len(set([i for i in NR_List if i < 8]))
Number_NRU = len([i for i in NR_List if i >= 8])
max_p= (Number_NRD + Number_NRU,8)[Number_NRD +Number_NRU>=8]
min_P= (Number_NRD,1)[Number_NRD == 0]
print(min_p + " " + max_p)

Submission status: Runtime Error

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

free = 0
color = [0]*9
for i in range(N):
    if a[i]>3200:
        color[8] += 1
    color[a[i]//400] += 1
mini = 0
for i in color[0:8]:
    if i != 0:
        mini += 1
print(str(mini)+' '+str(min(mini+color[8],9)))

Submission status: Runtime Error

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

hai = 0
tya = 0
mizu = 0
ao = 0
ki = 0
dai = 0
aka = 0
mu = 0

for a in A:
  if a <= 399:
    hai = 1
  elif a <= 799:
    tya = 1
  elif a <= 1199:
    mizu = 1
  elif a <= 1599:
    ao = 1
  elif a <= 1999:
    ki = 1
  elif a <= 2399:
    dai = 1
  elif a <= 3199:
    aka = 1
  else:
    mu += 1
    
max_num = min(8, hai + tya + mizu + ao + ki + dai + aka + mu)
min_num = max(hai + tya + mizu + ao + ki + dai + aka)

print(min_num, max_num)

Submission status: Runtime Error

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

cnt = [0]*8
c = 0
for a in A:
    if a <= 399:
        cnt[0] += 1
    elif a >= 400 and a <= 799:
        cnt[1] += 1
    elif a >= 800 and a <= 1199:
        cnt[2] += 1
    elif a >= 1200 and a <= 1599:
        cnt[3] += 1
    elif a >= 1600 and a <= 1999:
        cnt[4] += 1
    elif a >= 2000 and a <= 2399:
        cnt[5] += 1
    elif a >= 2400 and a <= 2799:
        cnt[6] += 1
    elif a >= 2800 and a <= 3199:
        cnt[7] += 1
    else:
        c += 1
        
Min = len([i for i in cnt if i != 0]), 0
if c == 0:
    print(Min, Min)
else:
    Max = min(8, Min+c)
    if Min == 0:
        print(1, Max)
    else:
        print(Min, Max)

Submission status: Runtime Error

Solution code:
N = int(input())
R = list(map(int, input().split()))
X = [0]*8
p = 0
for r in R:
  if r >= 3200:
    p += 1
  else:
    X[r//400] = 1

s = sum(X)
if s == 0:
  print(str(1) + " " + str(cnt))
else:
  print(str(s) + " " + str(s + cnt))

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
X = [0 for i in range(8)]
cnt = 0
for a in A:
  if a == 3200:
    cnt += 1
  else:
    X[a // 400] = 1
s = sum(X)
if s == 0:
  print(str(1) + " " + str(min(8, cnt)))
else:
  print(str(s) + " " + str(min(8, s + cnt)))

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
a1=0
b=0
c=0
d=0
e=0
f=0
g=0
h=0
ans=0
for i in range(n):
  if 1<=a[i]<=399:
    a1=1
  elif 400<=a[i]<=799:
    b=1
  elif 800<=a[i]<=1199:
    c=1
  elif 1200<=a[i]<=1599:
    d=1
  elif 1600<=a[i]<=1999:
    e=1
  elif 2000<=a[i]<=2399:
    f=1
  elif 2400<=a[i]<=2799:
    g=1
  elif 2800<=a[i]<=3199:
    h=1
  else:
    ans+=1

x=a1+b+c+d+e+f+g+h
if a1=b=c=d=e=f=g=h=0:
  print(1,ans)
else:
  print(x,x+ans)

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    rate_list = [0] * 9

    for a in a_list:
        rate_list[a // 400] += 1

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

    print(min_cnt, min_cnt + rate_list[-1])


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

for n in range(N):
  if 1 <= a[n] < 400:
    color.add("gray")
  elif 400 <= a[n] < 800:
    color.add("brown")
  elif 800 <= a[n] < 1200:
    color.add("green")
  elif 1200<= a[n] < 1600:
    color.add("water")
  elif 1600 <= a[n] < 2000:
    color.add("blue")
  elif 2000 <= a[n] < 2400:
    color.add('yellow')
  elif 2400 <= a[n] < 2800:
    color.add('orange')
  elif 2800 <= a[n] < 3200:
    color.add('red')
  else:
    rainbow += 1

if color_min > rainbow:
  color_min = len(color)
else:
  color_min = rainbow
  
color_max = color_min + rainbow

    
print(f'{color_min} {color_max}')

Submission status: Runtime Error

Solution code:
n=int(input())
x=list(map(int,input().split()))
l=[0 for i in range(10)]
d=0
for i in x:
  if i in range(400):
    l[0]+=1
  elif i in range(400,800):
    l[1]+=1
  elif i in range(800,1200):
    l[2]+=1
  elif i in range(1200,1600):
    l[3]+=1
  elif i in range(1600,2000):
    l[4]+=1
  elif i in range(2000,2400):
    l[5]+=1
  elif i in range(2400,2800):
    l[6]+=1
  elif i in range(2800,3200):
    l[7]+=1
  else:
    d+=1
p=[i for i in l if i>0]
print(min(p),max(p)+d)

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int,input().split()))
x=[0 for i in range(10)]
d=0
for i in l:
  if i in range(400):
    l[0]+=1
  elif i in range(400,800):
    l[1]+=1
  elif i in range(800,1200):
    l[2]+=1
  elif i in range(1200,1600):
    l[3]+=1
  elif i in range(1600,2000):
    l[4]+=1
  elif i in range(2000,2400):
    l[5]+=1
  elif i in range(2400,2800):
    l[6]+=1
  elif i in range(2800,3200):
    l[7]+=1
  else:
    d+=1
p=[i for i in x if i>0]
print(min(p),max(p)+d)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

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

    l = [0] * 9
    for i in range(N):
        l[a[i] // 400] += 1

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

    gold = l[8]
    if gold > 8:
        gold = 8

    if ans_min == 0:
        ans_min = 1

    ans_max = ans_min
    non_color = l.count(0)
    if gold >= non_color:
        ans_max = 8
    else:
        ans_max += gold

    print(ans_min, ans_max)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
rate = list(map(int,input().split()))
ratecolor = 0
free = 0
ratecolor = 0
color = [0]*9
for i in range(n):
        if(rate[i] >= 3200):
            free += 1
            break
    for j in range(9):
        if(rate[i] < j*400 + 400):
            if(color[j] == 0):
                color[j] += 1
                ratecolor += 1
                break

print(ratecolor if ratecolor != 0 else 1,ratecolor+free)