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 = input()
a = input()
tmp_a = a.split()
a_list = []
o_list = []
flag = 0

for i in range(int(n)):
    if int(tmp_a[i]) < 400:
        a_list.append("gray")
    elif 400 <= int(tmp_a[i]) and int(tmp_a[i]) < 800:
        a_list.append("brown")
    elif 800 <= int(tmp_a[i]) and int(tmp_a[i]) < 1200:
        a_list.append("green")
    elif 1200 <= int(tmp_a[i]) and int(tmp_a[i]) < 1600:
        a_list.append("sky")
    elif 1600 <= int(tmp_a[i]) and int(tmp_a[i]) < 2000:
        a_list.append("blue")
    elif 2000 <= int(tmp_a[i]) and int(tmp_a[i]) < 2400:
        a_list.append("yellow")
    elif 2400 <= int(tmp_a[i]) and int(tmp_a[i]) < 2800:
        a_list.append("orange")
    elif 2800 <= int(tmp_a[i]) and int(tmp_a[i]) < 3200:
        a_list.append("red")
    else:
        o_list.append("other")

n_other = len(o_list)

if len(set(a_list))==0:
    min_num = 1
else:
    min_num = len(set(a_list))

max_num = len(set(a_list))+n_other
#if max_num > 8:
#    max_num = 8

print(min_num, max_num)

Submission status: Accepted

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

Submission status: Accepted

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

    color = set()
    etc = 0
    for a in A:
        idx = a // 400
        if idx >= 8:
            etc += 1
        else:
            color.add(idx)

    min_ = len(color)
    if min_ == 0:
        min_ = 1
    max_ = len(color) + etc

    print(min_, max_)

main()

Submission status: Accepted

Solution code:
from collections import Counter
input()
c = Counter([min(int(i)//400,8) for i in input().split()])
ans = 0
for i in range(8):
 ans += bool(c[i])
print(max(ans,1),ans+c[8])

Submission status: Accepted

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

memo = [0 for i in range(9)]
for i in a:
	if(i < 3200):
		memo[i / 400] = memo[i / 400] + 1
	else:
		memo[8] = memo[8] + 1;

cnt = 0
for i in range(8):
	if memo[i] > 0:
		cnt = cnt + 1;
free = memo[8]

if cnt == 0:
	print 1, memo[8]
else:
	print cnt, memo[8] + cnt

Submission status: Accepted

Solution code:
n=int(input())
a=input().split()
min=0
max=0
c=[]
for i in range(n):
    per=int(int(a[i])/400)
    
    if per not in c and per<8:
        min+=1
        max+=1
    if (per>=8):
        max+=1
    c.append(per)
flag=0
for i in range(n):
    if(c[i]<8):
        flag=1
if flag==0:
    min+=1
print(min," ",max)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
kind = []
var = 0

def d_color(num):
     if 1<=num and num<=399:
         return "a"
     elif 400<=num and num<=799:
         return "b"
     elif 800<=num and num<=1199:
         return "c"
     elif 1200<=num and num<=1599:
         return "d"
     elif 1600<=num and num<=1999:
         return "e"
     elif 2000<=num and num<=2399:
         return "f"
     elif 2400<=num and num<=2799:
         return "g"
     else:
         return "h"

for i in range(n):
    if a[i]<3200:
        kind.append(d_color(a[i]))
    else:
        var += 1

kind = list(set(kind))

MIN ,MAX = len(kind),len(kind)+var
if MIN == 0:
    MIN =1 

print(MIN,MAX)

Submission status: Accepted

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
min_ans = len(set(color))
if min_ans == 0 and other != 0:
    min_ans = 1
print(min_ans, max_ans)

Submission status: Accepted

Solution code:
N = int(input())
a = map(int, input().split())
rate_under = []
rate_upper = []
for i in a:
    x = i // 400
    if(x >= 8):
        rate_upper.append(x)
    else:
        rate_under.append(x)
min = len(set(rate_under))
max = min + len(rate_upper)
if(min == 0):
    min = 1
print(str(min) + " " + str(max))

Submission status: Accepted

Solution code:
a = input()
b = input().split()
c = [0, 0, 0, 0, 0, 0, 0, 0]
d = 0
e = 0
for i in b:
    j = 0
    while j < len(c):
        if j == 0 and c[j] == 0 and (1 <= int(i) < 400):
            c[j] += 1
            d += 1
        elif c[j] == 0 and (400 * j <= int(i) < 400 * (j+1)):
            c[j] += 1
            d += 1
        j += 1
    if int(i) >= 3200:
        e += 1
min, max = d, d+e
if d == 0:
    min = 1
print(min, max)

Submission status: Accepted

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

N = int(input())
rates = [int(x) for x in input().split()]

rates.sort()
uppers = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 4800]
accum = list()
counts = list()

for upper in uppers:
    accum.append(len([x for x in rates if x <= upper]))

counts.append(accum[0])
for i in range(1, 9):
    counts.append(accum[i] - accum[i-1])

_least = sum([1 for count in counts[:-1] if count > 0])
max_scorerer = counts[-1]

if _least == 0:
    least = 1
    most = max_scorerer
else:
    least = _least
    most = least + max_scorerer

print("{} {}".format(least, most))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 28 21:42:33 2016

@author: you
"""

n = int(input())
a = list(map(int, input().split()))
colornum = 0
colorflag = [0,0,0,0,0,0,0,0]
rainbow = 0
maxvalue = 0
minvalue = 0
for i in range(n):
    if colorflag[0] == 0 and a[i] < 400:
        colornum = colornum + 1
        colorflag[0] = 1
    elif colorflag[1] == 0 and a[i] >= 400 and a[i] < 800:
        colornum = colornum + 1
        colorflag[1] = 1
    elif colorflag[2] == 0 and a[i] >= 800 and a[i] < 1200:
        colornum = colornum + 1
        colorflag[2] = 1
    elif colorflag[3] == 0 and a[i] >= 1200 and a[i] < 1600:
        colornum = colornum + 1
        colorflag[3] = 1
    elif colorflag[4] == 0 and a[i] >= 1600 and a[i] < 2000:
        colornum = colornum + 1
        colorflag[4] = 1
    elif colorflag[5] == 0 and a[i] >= 2000 and a[i] < 2400:
        colornum = colornum + 1
        colorflag[5] = 1
    elif colorflag[6] == 0 and a[i] >= 2400 and a[i] < 2800:
        colornum = colornum + 1
        colorflag[6] = 1
    elif colorflag[7] == 0 and a[i] >= 2800 and a[i] < 3200:
        colornum = colornum + 1
        colorflag[7] = 1
    elif a[i] >= 3200:
        rainbow = rainbow + 1
for j in range(8):
    if colorflag[j] == 1:
        minvalue = minvalue + 1
maxvalue = minvalue + rainbow
if minvalue == 0:
    minvalue = 1
    maxvalue = rainbow
print(minvalue,maxvalue)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
b = set(ai // 400 for ai in a if ai < 3200)
m = len([ai for ai in a if ai > 3199])

if m == 0:
    print("{0} {0}".format(len(b)))
else:
    print("{0} {1}".format(max(len(b), 1), len(b) + m))

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
list = []
list_of_topcoder = []

for i in range(n):
    if 1<=int(a[i])<=399:
        if "gray" not in list:
            list.append("gray")
        else:
            pass
    elif 400<=int(a[i])<=799:
        if "brown" not in list:
            list.append("brown")
        else:
            pass
    elif 800<=int(a[i])<=1199:
        if "green" not in list:
            list.append("green")
        else:
            pass
    elif 1200<=int(a[i])<=1599:
        if "water" not in list:
                list.append("water")
        else:
            pass
    elif 1600<=int(a[i])<=1999:
        if "blue" not in list:
            list.append("blue")
        else:
            pass
    elif 2000<=int(a[i])<=2399:
        if "yellow" not in list:
            list.append("yellow")
        else:
            pass
    elif 2400<=int(a[i])<=2799:
        if "orange" not in list:
            list.append("orange")
        else:
            pass
    elif 2800<=int(a[i])<=3199:
        if "red" not in list:
            list.append("red")
        else:
            pass
    elif 3200<=int(a[i])<=4800:
        list_of_topcoder.append(i)

if len(list) != 0:
    print(len(list), len(list)+len(list_of_topcoder))
else:
    print(1, len(list_of_topcoder))

Submission status: Accepted

Solution code:

borders = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
def getcolor(rate):
    i = 0
    for border in borders:
        if rate < border:
            return i
        i += 1
    return -1

N = int(input())
rates = [int(x) for x in input().split(" ")]
colors = [0 for _ in range(len(borders))]
topcoders = 0

for rate in rates:
    c = getcolor(rate)
    if c != -1:
        colors[c] = 1
    else:
        topcoders += 1

s_c = sum(colors)
ans = "{0} {1}".format(max(s_c, 1), s_c + topcoders)
print(ans)

Submission status: Accepted

Solution code:
nb = int(input())
alist = list(map(int,input().split()))
R = [0]*9
for r in alist:
  r //= 400
  if r < 8:
    R[r] = 1
  else:
    R[8] += 1
amin = max(1,sum(R[:8]))
amax = sum(R)
print("{} {}".format(amin,amax))

Submission status: Accepted

Solution code:
import numpy as np

if __name__ == "__main__":
    N = int(input())
    a = input().split()

    a = list(map(int, a))
    a = np.array(a)

    colors_flag = np.zeros(8)
    other = 0
    for rate in a:
        if(rate >= 3200):
            other += 1
        elif(colors_flag[int(rate/400)] == 1):
            continue
        else:
            colors_flag[int(rate/400)] = 1
    color_num = np.sum(colors_flag)
    print(int(color_num if color_num != 0 else 1), int(color_num + other))

Submission status: Accepted

Solution code:
N = int(input())
n = [int(i)//400 for i in input().split()]
c = 0
for i in n:
    if i >= 8:
        c += 1
n_kind = [i for i in n if i<8]
a = len(set(n_kind))
if a == 0:
    print(1,c)
else:print(a,a+c)

Submission status: Accepted

Solution code:
input();A=map(int,input().split());C=[0]*99;D=0
for a in A:a//=400;D+=a>7;C[a]=a<8
E=sum(C);print(max(E,1),E+D)

Submission status: Accepted

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

COLOR_LIST = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
free_color = 0
color_contain = [0, 0, 0, 0, 0, 0, 0, 0]



for i in a:
	cnt = 0
	for j in COLOR_LIST:
		if i > j:
			cnt += 1
	
	if cnt < len(color_contain):
	    color_contain[cnt] = 1
	else:
	    free_color += 1

if free_color == 0:
	min_ans = sum(color_contain)
	max_ans = sum(color_contain)
else:
    min_ans = max(1, sum(color_contain))
    max_ans = sum(color_contain) + free_color
print(min_ans, max_ans)

Submission status: Accepted

Solution code:
N=int(input())
nums=input().split()
r1=0
r2=0
r3=0
r4=0
r5=0
r6=0
r7=0
r8=0
r9=0
for n in range(0,N):
    if 1<=int(nums[n])<=399:
        r1=1
    if 400<=int(nums[n])<=799:
        r2=1
    if 800<=int(nums[n])<=1199:
        r3=1
    if 1200<=int(nums[n])<=1599:
        r4=1
    if 1600<=int(nums[n])<=1999:
        r5=1
    if 2000<=int(nums[n])<=2399:
        r6=1
    if 2400<=int(nums[n])<=2799:
        r7=1
    if 2800<=int(nums[n])<=3199:
        r8=1
    if 3200<=int(nums[n]):
        r9=r9+1

if r1==r2==r3==r4==r5==r6==r7==r8==0 :
    if 1<=r9<=8:
        p1=r9
        p2=1
    else:
        p1=8
        p2=1
else:
    p1=r1+r2+r3+r4+r5+r6+r7+r8+r9
    p2=r1+r2+r3+r4+r5+r6+r7+r8

print(p2,p1)

Submission status: Accepted

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

import sys
import os

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

B = [0] * 8
any_color = 0

for a in A:
    if a <= 399:
        B[0] += 1
    elif a <= 799:
        B[1] += 1
    elif a <= 1199:
        B[2] += 1
    elif a <= 1599:
        B[3] += 1
    elif a <= 1999:
        B[4] += 1
    elif a <= 2399:
        B[5] += 1
    elif a <= 2799:
        B[6] += 1
    elif a <= 3199:
        B[7] += 1
    else:
        any_color += 1

if any_color == N:
    print(1, any_color)
else:
    colored_num = len([b for b in B if b > 0])
    zero_num = len([b for b in B if b == 0])
    max_num = colored_num + any_color
    print(colored_num, max_num)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
col = [0 for i in range(n)]
cnt = 0
for i in range(n):
    if 1 <= a[i] <=399:
        col[i] = "b"
    elif 400<= a[i]<=799:
        col[i] = "c"
    elif 800<= a[i]<=1199:
        col[i] = "d"
    elif 1200<= a[i]<=1599:
        col[i] = "e"
    elif 1600<= a[i]<=1999:
        col[i] = "f"
    elif 2000<= a[i]<=2399:
        col[i] = "g"
    elif 2400<= a[i]<=2799:
        col[i] = "h"
    elif 2800<= a[i]<=3199:
        col[i] = "j"
    else:
        col[i] = "k"
        cnt += 1
colv = list(set(col))
mn =mx = len(colv)
if "k" in colv:
        mn -=1
        mx += cnt-1
        if mn == 0:
            mn =1
        
print(str(mn)+" "+str(mx))

Submission status: Accepted

Solution code:
n = int(input())

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

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

count = 0

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

for i in a:
	check(i)

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

color_min = 8 - count
color_max = color_min+colors[8]

if color_min==0:
	color_min = 1

print(color_min,color_max)

Submission status: Accepted

Solution code:
N = int(input())
a = input().split()
b = []
for ii in range(9):
    b.append(0)
for ii in range(N):
    if int(a[ii]) < 400:
        b[0] = b[0] + 1
    elif int(a[ii]) < 800:
        b[1] = b[1] + 1
    elif int(a[ii]) < 1200:
        b[2] = b[2] + 1
    elif int(a[ii]) < 1600:
        b[3] = b[3] + 1
    elif int(a[ii]) < 2000:
        b[4] = b[4] + 1
    elif int(a[ii]) < 2400:
        b[5] = b[5] + 1
    elif int(a[ii]) < 2800:
        b[6] = b[6] + 1
    elif int(a[ii]) < 3200:
        b[7] = b[7] + 1
    else:
        b[8] = b[8] + 1
min = 0
max = 0
for ii in range(8):
    if b[ii] > 0:
        min = min + 1
        max = max + 1
max = max + b[8]
if min == 0 and b[8] >0:
    min = 1
print(str(min) + ' ' + str(max))

Submission status: Accepted

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

def get_cols(rates):
    col_flags = [False for _ in range(8)]
    wild_colors = 0
    for rate in rates:
        if rate >= 3200:
            wild_colors += 1
        else:
            col_flags[rate // 400] = True

    decided_cols = col_flags.count(True)
    max_cols = decided_cols + wild_colors
    
    if decided_cols > 0:
        min_cols = decided_cols
    else:
        min_cols = 1
    return (min_cols, max_cols)

print("{} {}".format(*get_cols(rates)))

Submission status: Accepted

Solution code:

N = int(input())
a = [int(e) for e in input().split()]

def colors(score):
    if score < 400:
        return 1
    elif score < 800:
        return 2
    elif score < 1200:
        return 3
    elif score < 1600:
        return 4
    elif score < 2000:
        return 5
    elif score < 2400:
        return 6
    elif score < 2800:
        return 7
    elif score < 3200:
        return 8
    elif score >= 3200:
        return 0

ary = [colors(s) for s in a]
ary_n = set(ary)

if not 0 in ary_n:
    n_min = len(ary_n)
    n_max = len(ary_n)
else:
    n_zero = sum([e == 0 for e in ary])
    n_min = len(ary_n) - 1 if len(ary_n) > 1 else 1
    n_max = len(ary_n) + n_zero - 1

print(n_min, n_max)

Submission status: Accepted

Solution code:
N = int(input())

exist = [False for i in range(8)]
colorful = 0
min = 0

rates = list(map(int, input().split(" ")))

for rate in rates:
    if rate >= 3200:
        colorful += 1
        continue
    if not exist[int(rate/400)]:
        exist[int(rate / 400)] = True
        min += 1

max_color = colorful + min
if min == 0:
    min = 1

result = str(min) + " " + str(max_color)
print(result)

Submission status: Accepted

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:
    if i >= 1 and i <= 399:
        ranks[0] = True
    elif i >= 400 and i <= 799:
        ranks[1] = True
    elif i >= 800 and i <= 1199:
        ranks[2] = True
    elif i >= 1200 and i <= 1599:
        ranks[3] = True
    elif i >= 1600 and i <= 1999:
        ranks[4] = True
    elif i >= 2000 and i <= 2399:
        ranks[5] = True
    elif i >= 2400 and i <= 2799:
        ranks[6] = True
    elif i >= 2800 and i <= 3199:
        ranks[7] = True
lows = len([i for i in ranks if i == True])

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

print(minimum, maximum)

Submission status: Accepted

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: Accepted

Solution code:
r = [
[1,399],
[400,799],
[800,1199],
[1200,1599],
[1600,1999],
[2000,2399],
[2400,2799],
[2800,3199],
]

field = [0 for x in range(len(r))]

ok = 3200
oknum = 0

n = int(input())

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

for x in a:
    if x >= ok:
        oknum += 1
        continue
    for i, v in enumerate(r):
        if v[0] <= x <= v[1]:
            field[i] = 1


sumf = sum(field)

print(sumf if sumf != 0 else 1, min(sumf + oknum, sumf + oknum))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

_ = input()
As = list(map(int, input().split()))
bins = [0] * 9
table = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 10000]
for a in As:
    for i, t in enumerate(table):
        if a < t:
            bins[i] += 1
            break
mn = sum(1 for x in bins[:-1] if x > 0)
if mn == 0:
    mn = 1
    mx = bins[-1]
else:
    mx = mn + bins[-1]
print(mn, mx)

Submission status: Accepted

Solution code:
n=int(raw_input())
a=map(int,raw_input().split())
b=[0]*9
for i in a:
	c=i//400
	if c>=8:
		b[8]+=1
	else:
		b[c]=b[c] or 1

if sum(b[:-1])==0 and b[-1]!=0:
	d=1
else:
	d=sum(b[:-1])

print d,sum(b)

Submission status: Accepted

Solution code:
import numpy as np
 
n = int(input())
a = list(int(i) for i in input().split()) 
a.sort()
minCount = 0
maxCount = 0
count = np.zeros(9)

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

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

maxCount = maxCount + count[8]
if minCount == 0 :
    minCount = 1

#print (a)
print (minCount, end =' ')
print (int(maxCount))

Submission status: Accepted

Solution code:
# coding: utf-8

n = input()
a = map(int, raw_input().split())
rate = [0] * 9

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

if 1 in rate[:8]:
    print sum(rate[:8]), sum(rate)
else:
    print 1, sum(rate)

Submission status: Accepted

Solution code:
colors = {"hai": False,
          "cha": False,
          "midori": False,
          "mizu": False,
          "ao": False,
          "ki": False,
          "daidai": False,
          "aka": False}
i2c = [None]*3200
for i in range(3200):
    if i < 400:
        i2c[i] = "hai"
    elif i < 800:
        i2c[i] = "cha"
    elif i < 1200:
        i2c[i] = "midori"
    elif i < 1600:
        i2c[i] = "mizu"
    elif i < 2000:
        i2c[i] = "ao"
    elif i < 2400:
        i2c[i] = "ki"
    elif i < 2800:
        i2c[i] = "daidai"
    else:
        i2c[i] = "aka"
n = int(input())
rates = [int(i) for i in input().split()]
jiyu = 0
for x in rates:
    if x >= 3200:
        jiyu += 1
    else:
        colors[i2c[x]] = True
saisho = 0
# print(jiyu, colors)
for x in colors:
    if(colors[x]):
        saisho += 1
if(saisho < 1):
    saisho = 1
    jiyu -= 1
print(saisho, saisho+jiyu)

Submission status: Accepted

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

X = [0 for _ in range(13)]
for a in A:
    X[a / 400] += 1
cnt = 0
for x in X[:8]:
    if x != 0:
        cnt += 1
cnt2 = sum(X[8:])

print max(1, cnt), cnt + cnt2

Submission status: Accepted

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

over = 0
color = set()
for ai in a:
    if ai/400 >= 8:
        over += 1
    else:
        color.add(ai/400)

print max(1, len(color)), len(color) + over

Submission status: Accepted

Solution code:
N = int(input())
data = list(map(int,input().split()))
box = [0]*8
num = 0
for i in range(len(data)):
        x = int(data[i] / 400)
        if x < 8:
            box[x] += 1
        else:
            num += 1
answer = len(box)   - box.count(0)
if answer == 0:
    print(1,num)
else:
    print(answer,(answer+num))

Submission status: Accepted

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

color=[0]*8
free=0

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

c=len(color)-color.count(0)

m=c+free

if c==0:
    c=1

print c,m

Submission status: Accepted

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

n = int(input())
a = list(map(int, input().split()))
s = set()
for i in a:
    if 1 <= i <= 399 : s.add(1)
    if 400 <= i <= 799 : s.add(2)
    if 800 <= i <= 1199 : s.add(3)
    if 1200 <= i <= 1599 : s.add(4)
    if 1600 <= i <= 1999 : s.add(5)
    if 2000 <= i <= 2399 : s.add(6)
    if 2400 <= i <= 2799 : s.add(7)
    if 2800 <= i : s.add(8)
r = len([1 for x in a if 2800 <= x <= 3199]) < 1
print(len(s), len(s) + max((len([1 for x in a if x > 3199]) - r, 0)))

Submission status: Accepted

Solution code:
N = int(input())
A = input().split()
b = [0]*8
c = 0

for a in A:
    a = int(a)
    if 1<=a<=399:
        b[0] += 1
    elif 400<=a<=799:
        b[1] += 1
    elif 800<=a<=1199:
        b[2] += 1
    elif 1200<=a<=1599:
        b[3] += 1
    elif 1600<=a<=1999:
        b[4] += 1
    elif 2000<=a<=2399:
        b[5] += 1
    elif 2400<=a<=2799:
        b[6] += 1
    elif 2800<=a<=3199:
        b[7] += 1
    elif 3200<=a:
        c += 1

if c == 0:
    print(8-b.count(0), end=" ")
else:
    print(max(8-b.count(0),1), end=" ")

print(8-b.count(0)+c)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]


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


x = [color(a) for a in A]
dora = x.count(8)
unique = len(set(x)) if dora == 0 else len(set(x)) - 1
min_ = max(1, unique)
max_ = unique + dora
print(min_, max_)

Submission status: Accepted

Solution code:
N = input()
rates = [int(x) for x in input().split()]
colors = [0,0,0,0,0,0,0,0]
target = 0

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

non_target = sum(colors)
MAX = non_target + target

if non_target == 0:
	MIN = 1
else:
	MIN = non_target

print(MIN,MAX)

Submission status: Accepted

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))
    if None in res: res.remove(None)
    mi = max(1, len(res))
    ma = len(res) + len(x)
    print(mi, ma)

c()

Submission status: Accepted

Solution code:
# coding: utf-8
import array, bisect, collections, copy, heapq, itertools, math, random, re, string, sys, time

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7


def II(): return int(input())
def ILI(): return list(map(int, input().split()))
def IAI(LINE): return [ILI() for __ in range(LINE)]
def IDI(): return {key: value for key, value in ILI()}


def read():
    N = II()
    a = ILI()
    return (N, a)


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

    num_else = sum(count[0: 8])
    ans_max = sum(count)
    if num_else == 0:
        ans_min = 1
    else:
        ans_min = num_else
    
    ans = (ans_min, ans_max)
    return ans


def main():
    params = read()
    ans = solve(*params)
    print("{} {}".format(ans[0], ans[1]))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def get_color_index(rate):
    if 1 <= rate and rate <= 399:
        return 0
    elif 400 <= rate and rate <= 799:
        return 1
    elif 800 <= rate and rate <= 1199:
        return 2
    elif 1200 <= rate and rate <= 1599:
        return 3
    elif 1600 <= rate and rate <= 1999:
        return 4
    elif 2000 <= rate and rate <= 2399:
        return 5
    elif 2400 <= rate and rate <= 2799:
        return 6
    elif 2800 <= rate and rate <= 3199:
        return 7
    else:
        return -1

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

colors = []
wildcard_count = 0

for i in range(N):
    c = get_color_index(a[i])
    if c == -1:
        wildcard_count += 1
    elif c not in colors:
        colors.append(c)

c_min = max(len(colors), 1)
c_max = len(colors) + wildcard_count

print(str(c_min) + ' ' + str(c_max))

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
B = set()
C = []
for i in A:
    if 1<= i <= 399:
        B.add("grey")
    elif 400 <= i <= 799:
        B.add("brown")
    elif 800 <= i <= 1199:
        B.add("green")
    elif 1200 <= i <= 1599:
        B.add("sky")
    elif 1600 <= i <= 1999:
        B.add("blue")
    elif 2000 <= i <= 2399:
        B.add("yellow")
    elif 2400 <= i <= 2799:
        B.add("orange")
    elif 2800 <= i <= 3199:
        B.add("red")
    else:
        C.append("X")

if C:
    S = len(B)
    T = len(B) + len (C)
    if S == 0:
        S = 1
    print(str(S) + " " + str(T))
else:
    print(str(len(B)) + " " + str(len(B)))