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: Runtime Error

Solution code:
N = int(input())
a = list(map(int, input().split()))
gray = 0
brown = 0
green = 0
sky = 0
blue = 0
yellow = 0
orange = 0
red = 0
god = 0
for i in range(N):
    if a[i] < 400:
        gray = 1
    elif a[i] < 800:
        brown = 1
    elif a[i] < 1200:
        green = 1
    elif a[i] < 1600:
        sky = 1
    elif a[i] < 2000:
        blue = 1
    elif a[i] < 2400:
        yellow = 1
    elif a[i] < 2800:
        orange = 1
    elif a[i] < 3200:
        red = 1
    else:
        god+=1
zako = gray + brown + green + sky + blue + yellow + orange + red
if god > 0 and zako =0:
    color_max = god
    color_min = 1
elif god > 0 and zako != 0:
    color_max = zako + god
    color_min = zako
else:
    color_max = zako
    color_min = zako
print(color_min, color_max)

Submission status: Runtime Error

Solution code:
    N = int(input())
    a = list(map(int, input().split()))
    gray = 0
    brown = 0
    green = 0
    sky = 0
    blue = 0
    yellow = 0
    orange = 0
    red = 0
    god = 0
    for i in range(N):
        if a[i] < 400:
            gray = 1
        elif a[i] < 800:
            brown = 1
        elif a[i] < 1200:
            green = 1
        elif a[i] < 1600:
            sky = 1
        elif a[i] < 2000:
            blue = 1
        elif a[i] < 2400:
            yellow = 1
        elif a[i] < 2800:
            orange = 1
        elif a[i] < 3200:
            red = 1
        else:
            god+=1
    if god > 0:
        color_max = gray + brown + green + sky + blue + yellow + orange + red + god
        color_min = gray + brown + green + sky + blue + yellow + orange + red + 1
    else:
        color_max = gray + brown + green + sky + blue + yellow + orange + red
        color_min = color_max
    print(color_min, color_max)

Submission status: Runtime Error

Solution code:
    N = int(input())
    a = list(map(int, input().split()))
    gray = 0
    brown = 0
    green = 0
    sky = 0
    blue = 0
    yellow = 0
    orange = 0
    red = 0
    god = 0
    for i in range(N-1):
        if a[i] < 400:
            gray = True
        elif a[i] < 800:
            brown = True
        elif a[i] < 1200:
            green = True
        elif a[i] < 1600:
            sky = True
        elif a[i] < 2000:
            blue = True
        elif a[i] < 2400:
            yellow = True
        elif a[i] < 2800:
            orange = True
        elif a[i] < 3200:
            red = True
        else:
            god+=1
    if god > 0:
        color_max = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red) + god
        color_min = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red)
    else:
        color_max = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red)
        color_min = color_max
    print(color_min, color_max)

Submission status: Runtime Error

Solution code:
l=[0]*13
input()
for i in input().split():;l[int(i)//400]+=1
r=sum([1 for a in l[:8] if a > 0])
print(max(1,r),r+sum(l[8:]))

Submission status: Runtime Error

Solution code:
cat ABC064C.py
l=[0]*13
input()
for i in input().split():;l[int(i)//400]+=1
r=sum([1 for a in l[:8] if a > 0])
print(max(1,r),r+sum(l[8:]))

Submission status: Runtime Error

Solution code:
l=[0]*13
input()
for i in input().split():
  l[int(i)//400]+=1
r=sum([1 for a in l[:8] if a > 0])
print(max(1,r,r+sum(l[8:])

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int, input().split()))
gray = 0
brown = 0
green = 0
sky = 0
blue = 0
yellow = 0
orange = 0
red = 0
god = 0
for i in range(N-1):
    if a[i] < 400:
        gray = True
    elif a[i] < 800:
        brown = True
    elif a[i] < 1200:
        green = True
    elif a[i] < 1600:
        sky = True
    elif a[i] < 2000:
        blue = True
    elif a[i] < 2400:
        yellow = True
    elif a[i] < 2800:
        orange = True
    elif a[i] < 3200:
        red = True
    else:
        god+=1
if god > 0:
    color_max = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red) + god + 1
    color_min = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red) + 1
else:
    color_max = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red)
    color_min = color_max
if color_max>8
    print(color_min, 8)
else:
    print(color_min, color_max)

Submission status: Runtime Error

Solution code:
import bisect

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

target = 0
l = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
cnt = [0 for i in range(len(l))]

for i in range(n):
    if a[i] >= 3200:
        target += 1
    else:
        x = bisect.bisect(l, a[i])
        # print ("value = " + str(a[i]) + ", x = " + str(x))
        cnt[x] += 1

mi = 0
ma = 0
for i in range(len(l)):
    if cnt[i] != 0:
        mi += 1

ma = mi + target
if mi == 0:
    mi = 1

print (str(mi) + " " + str(ma))

Submission status: Runtime Error

Solution code:
N=int(input())
a=[int(i) for i in input(). split ()]
b=[]
for i in range(9):
    b.append(0)
for i in range (N):
    if a[i]>=3200:
        b[8]+=1
    else:
        j=a[i]//400
        b[j]+=1
i=0
mi=0
while i<8:
    if b[i]>0:
        mi+=1
    i+=1
ma=mi
if b[8]>0:
    ma+=b[8]
if ma>8:
    ma=8
print (mi+" "+ma)

Submission status: Runtime Error

Solution code:
N=int(input())
a_n=[]
a2_n=[]
a_n = input().split(" ")
count = 0

for i in range(N):
    if int(a_n[i])/400 < 8:
         a2_n.append(int(a_n[i])/400)
    else:
        count += 1
if len(a2_n) == 0:
    num = 0
    n_min = 1
else:
    n_min = len(set(a2_n))
n_max = num+count

print(str(n_min)+" "+str(n_max))

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
a = [int(_) for _ in input().split()]
a = np.array(a)
a = np.sort(a)
min = 0
max = 0
m = 0

for i in range(8):
    set_1 = set(np.where(i*400<=a)[0])
    set_2 = set(np.where(a<(i+1)*400)[0])
    match = list(set_1 & set_2)
    if len(match)>0:
        min+=1
if min=0:
    min=1
    if N>8:
	max = 8
    else:
	max = N
else:
    if len(np.where(a>=3200)[0])==0:
        max = min
    else:
        max = min + len(np.where(a>=3200)[0])
    	if max>8:
            max = 8
print (min, max)

Submission status: Runtime Error

Solution code:
N=int(input())
a=[int(i) for i in input(). split ()]
b=[]
for i in range(9):
    b.append(0)
for i in range (N):
    if a[i]>=3200:
        b[8]+=1
    else:
        j=a[i]//400
        b[j]+=1
i=0
mi=0
while i<8:
    mi+=b[i]
    i+=1
ma=mi
if b[8]>0:
    ma+=b[8]
if b[8]>8:
    ma=8
print (mi+" "+ma)

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
a = [int(_) for _ in input().split()]
a = np.array(a)
a = np.sort(a)
min = 0
max = 0
m = 0

for i in range(8):
    set_1 = set(np.where(i*400<=a)[0])
    set_2 = set(np.where(a<(i+1)*400)[0])
    match = list(set_1 & set_2)
    if len(match)>0:
        min+=1
if min=0:
    min=1
    if N>8:
	max = 8
    else:
	max = N
else:
    if len(np.where(a>=3200)[0])==0:
        max = min
    else:
        max = min + len(np.where(a>=3200)[0])
    	if max>8:
            max = 8
print (min, max)

Submission status: Runtime Error

Solution code:
N=int(input())
a=[int(i) for i in input(). split ()]
b=[]
for i in range(9):
    b.append(0)
for i in range (N):
    if a[i]>=3200:
        b[8]+=1
    else:
        b[a[i]//400]+=1
i=0
mi=0
while i<8:
    mi+=b[i]
    i+=1
ma=mi
if b[8]>0:
    ma+=b[8]
if b[8]>8:
    ma=8
print (mi+" "+ma)

Submission status: Runtime Error

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

a.sort()
color = []
other = 0
for i in a:
    if i < 400 * 1:
        color.append('1')
    elif i < 400 * 2:
        color.append('2')
    elif i < 400 * 3:
        color.append('3')
    elif i < 400 * 4:
        color.append('4')
    elif i < 400 * 5:
        color.append('5')
    elif i < 400 * 6:
        color.append('6')
    elif i < 400 * 7:
        color.append('7')
    elif i < 400 * 8:
        color.append('8')
    else:
        other += 1
max_ans = len(set(color)) + other
if max_ans > 8:
    max_ans = 8
min_ans = len(set(color))
if min_ans == 0 and other != 0
    min_ans = 1
print(min_ans, max_ans)

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-
N = int(input())
a = list(map(int, input().split()))
rate = [ 0 for tmp in range(9) ]
factor = 0
empty = 0
for tmp in range(N):
    if 1 <= a[tmp] and  a[tmp] <= 399:
        rate[0] += 1
    elif 400 <= a[tmp] and a[tmp] <= 799:
        rate[1] += 1
    elif 800 <= a[tmp] and a[tmp] <= 1199:
        rate[2] += 1
    elif 1200 <= a[tmp] and a[tmp] <= 1599:
        rate[3] += 1
    elif 1600 <= a[tmp] and a[tmp] <= 1999:
        rate[4] += 1
    elif 2000 <= a[tmp] and a[tmp]<= 2399:
        rate[5] += 1
    elif 2400 <= a[tmp] and a[tmp] <= 2799:
        rate[6] += 1
    elif 2800 <= a[tmp] and a[tmp] <= 3199:
        rate[7] += 1
    else:
        rate[8] += 1
for tmp in range(len(rate)-1):
    if rate[tmp] > 0:
        factor += 1
    else:
        empty += 1
if rate[8] > 0:
    if factor == 0:
        print("1 "+str(rate[8])
    else:
        print(str(factor)+' '+str(factor+rate[8]))
else:
    print(str(factor)+' '+str(factor))

Submission status: Runtime Error

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

hai = 0
tya = 0
midori = 0
mizu = 0
ao = 0
ki = 0
daigai = 0
aka = 0

niji = 0

mincolor = 0
maxcolor = 0

for i in range(n):
    if 1 <= a[i] and a[i] <=399:
        hai = 1
    elif 400 <= a[i] and a[i] <= 799:
        tya = 1
    elif 800 <= a[i] and a[i] <= 1199:
        midori
    elif 1200 <= a[i] and a[i] <=1599:
        mizu = 1
    elif 1600 <= a[i] and a[i] <= 1999:
        ao = 1
    elif 2000 <= a[i] and a[i] <= 2399:
        ki = 1
    elif 2400 <= a[i] and a[i] <=2799:
        daidai = 1
    elif 2800 <= a[i] and a[i] <= 3199:
        aka = 1
    elif 3200 <= a[i]:
        niji += 1

mincolor = hai + tya + midori + mizu + ao + ki + daidai + aka
maxcolor = mincolor

for i in range(niji):
    maxcolor += 1

if maxcolor >= 9:
    maxcolor = 8

print(mincolor, maxcolor)

Submission status: Runtime Error

Solution code:
import math

ranks = [False for i in range(8)]
highs = 0
n = int(input())
inps = [int(i) for i in input().split()]
highs = len([i for i in inps if i > 3199])
inps = [i for i in inps if i <= 3199]
for i in inps:
    ranks[math.floor(i/399)] = True

lows = min(len([i for i in ranks if i == True]), 8) 

minimum = max(lows, 1)
maximum = lows + highs

print(minimum, maximum)

Submission status: Runtime Error

Solution code:
w =  int(input())
num = input().split(' ')
b = [int(x) for x in num]
a1 = [0, 399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
a2 = [0, 0 ,0, 0 ,0, 0 ,0, 0 ]
a3 = 0 
for e in range(1, 9):
    for i in range(len(b)):
        if b[i] <= a1[e] and b[i] > a1[e -1] :
            a2[e] = 1
        elif b[i] > 3199:
            a3 += 1

mi = int(sum(a2))
ma = int(mi + a3)
print(mi,  ma)

Submission status: Runtime Error

Solution code:
import math

ranks = [False for i in range(8)]
highs = 0
n = int(input())
inps = [int(i) for i in input().split()]
highs = len([i for i in inps if i > 3199])
inps = [i for i in inps if i <= 3199]
for i in inps:
    ranks[math.floor(i/399)] = True

lows = len([i for i in ranks if i == True]) 

minimum = max(lows, 1)
maximum = lows + highs

print(minimum, maximum)

Submission status: Runtime Error

Solution code:
memTime = int(input())
memLate = input().split()
memLate = [int(i) for i in memLate]
colorList = []
memColor = 0
highLate = 0
for color in memLate:
    if color // 400 >= 8:
        highLate += 1
    elif color // 400 in colorList == False
        colorList += color // 400
maxColor = len(colorList) + highLate
if maxColor > 7:
    maxColor = 7
print(str(len(colorList)) + " " + str(maxColor))

Submission status: Runtime Error

Solution code:
N = int(input())
x = list(map(int, input().split()))
a=[0]*8
b=0
for i in range(0,N):
    if x[i]>=3200:
        b +=1
for j in range(0,8):
    for i in range(0,N):
        if x[i]<400:
            a[j] +=1
            x[i] = inf
        x[i] -= 400

zerox=0
mincolar=0
 
for i in a:
    if i==0:
        zerox +=1  
    else:
        mincolar +=1

if(zerox<b):
    print(mincolar,mincolar+zerox)
else:
    print(mincolar,mincolar+b)


quit()

Submission status: Runtime Error

Solution code:
N=int(input())
a_n=[]
a_n = input().split(" ")
a_n = x.split(" ")
count = 0

a_n.sort()
for i in range(N):
    if int(a_n[i])/400 < 8:
         a_n[i] = int(a_n[i])/400
    else:
        count += 1

num = len(set(a_n))

print(str(num)+" "+str(num+count))

Submission status: Runtime Error

Solution code:
h=[0]*8
nu=0

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


for sa in a:
    fsa=int(sa/400)
    if fsa<=7:
        h[fsa]=1
    else:
        nu+=1

Min=sum(h)
Max=min(8,Min+nu)

print(str(Min)+" "+str(Max))

Submission status: Runtime Error

Solution code:
def c():
    n = int(input())
    a = list(map(int, input().split()))
    x = []
    def set_col(rate):
        if rate <= 399:
            return '灰色'
        elif rate <= 799:
            return '茶色'
        elif rate <= 1199:
            return '緑色'
        elif rate <= 1599:
            return '水色'
        elif rate <= 1999:
            return '青色'
        elif rate <= 2399:
            return '黄色'
        elif rate <= 2799:
            return '橙色'
        elif rate <= 3199:
            return '赤色'
        else:
            x.append(1)
            return

    res = set(map(set_col, a))
    res.remove(None)
    mi = max(1, len(res))
    ma = len(res) + len(x)
    print(mi, ma)

c()

Submission status: Runtime Error

Solution code:
import math

ranks = [False for i in range(8)]
highs = 0
n = int(input())
inps = [int(i) for i in input().split()]
highs = min(len([i for i in inps if i > 3199]), 8)
inps = [i for i in inps if i <= 3199]
for i in inps:
    ranks[math.floor(i/399)] = True

lows = len([i for i in ranks if i == True]) 

minimum = max(lows, 1)
maximum = lows + highs

print(minimum, maximum)

Submission status: Runtime Error

Solution code:

def c():
    n = int(input())
    a = list(map(int, input().split()))
    x = []
    def set_col(rate):
        if 1 <= rate <= 399:
            return '灰色'
        elif 400 <= rate <= 799:
            return '茶色'
        elif 800 <= rate <= 1199:
            return '緑色'
        elif 1200 <= rate <= 1599:
            return '水色'
        elif 1600 <= rate <= 1999:
            return '青色'
        elif 2000 <= rate <= 2399:
            return '黄色'
        elif 2400 <= rate <= 2799:
            return '橙色'
        elif 2800 <= rate <= 3199:
            return '赤色'
        else:
            x.append(1)
            return

    res = set(map(set_col, a))
    res.remove(None)
    mi = max(1, len(res))
    ma = min(8, len(res) + len(x)) # maximum color 8
    print(mi, ma)

c()

Submission status: Runtime Error

Solution code:
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

min_count = count

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

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

Submission status: Runtime Error

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

for sa in a:
    fsa=int(sa/400)    
    if fsa<=7:
        h[fsa]=1
    else:
        nu+=1

Min=sum(h)
Max=min(8,Min+(nu))

print(str(Min)+" "+str(Max))

Submission status: Runtime Error

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

for sa in a:
    fsa=int(sa/400)
    print(fsa)
    if fsa<=7:
        h[fsa]=1
    else:
        nu+=1

Min=sum(h)
Max=min(8,Min+(nu))

print(str(Min)+" "+str(Max))

Submission status: Runtime Error

Solution code:
import math

ranks = [False for i in range(8)]
highs = 0
n = int(input())
inps = [int(i) for i in input().split()]
highs = len([i for i in inps if i > 3199])
inps = [i for i in inps if i <= 3199]
for i in inps:
    ranks[math.floor(i/399)] = True

lows = len([i for i in ranks if i == True]) 

minimum = lows + (1 if ranks != 0 else 0) - 1
maximum = lows + highs

print(minimum, maximum)

Submission status: Runtime Error

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, re