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:
# -*- coding:utf-8 -*-

N = int(input())
a = input().split()

gray = 0
brown = 0
green = 0
sky = 0
blue = 0
yellow = 0
orange = 0
red = 0
other = 0
for i in range(N):
	a[i] = int(a[i])

	if 1 <= a[i] and a[i] <= 399:
		gray = 1
	elif 400 <= a[i] and a[i] <= 799:
		brown = 1
	elif 800 <= a[i] and a[i] <= 1199:
		green = 1
	elif 1200 <= a[i] and a[i] <= 1599:
		sky = 1
	elif 1600 <= a[i] and a[i] <= 1999:
		blue = 1
	elif 2000 <= a[i] and a[i] <= 2399:
		yellow = 1
	elif 2400 <= a[i] and a[i] <= 2799:
		orange = 1
	elif 2800 <= a[i] and a[i] <= 3199:
		red = 1
	elif 3200 <= a[i]:
		other = other + 1

sum = gray + brown + green + sky + blue + yellow + orange + red

if sum > 1:
	min = sum
else:
	min = 1

max = sum + other

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

Submission status: Accepted

Solution code:
n = int(input())
aa = [min(8, int(a) // 400) for a in input().split()]
over3200 = aa.count(8)
colors = len(set(aa))
_min = colors - 1 if over3200 and n > over3200 else colors
_max = colors + over3200 - 1 if over3200 else colors
print(_min, _max)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
c = []
d = []
for j in range(N):
  for i in range(0,8):
    if 400*(i) <= a[j] < 400*(i+1):
       if i not in c:
           c.append(i)
  if a[j] >= 3200:
        d.append(a[j])
if len(c) ==0:
    print(1,len(d))
else:
    print(len(c),len(c)+len(d))

Submission status: Accepted

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

color = [0] * 8
over = 0

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

mini = color.count(1)
maxi = color.count(1)

if over >= 1:
    if mini == 0:
        mini = 1

    maxi += over

print(mini, maxi)

Submission status: Accepted

Solution code:
n = int(raw_input())
l = map(int, raw_input().split())
ll = [False for _ in range(8)]
o = 0
for i in l:
    if i/400 < 8:
        ll[i/400] = True
    else:
        o += 1
c = ll.count(True)
if c == 0:
    print 1,o
else:
    print c,c+o

Submission status: Accepted

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

GRAY = 400
BROWN = 800
GREEN = 1200
CYAN = 1600
BLUE = 2000
YELLOW = 2400
ORANGE = 2800
RED = 3200

colors = []
over3200 = 0

for i in a:
    if i < GRAY:
        colors.append(GRAY)
    elif i < BROWN:
        colors.append(BROWN)
    elif i < GREEN:
        colors.append(GREEN)
    elif i < CYAN:
        colors.append(CYAN)
    elif i < BLUE:
        colors.append(BLUE)
    elif i < YELLOW:
        colors.append(YELLOW)
    elif i < ORANGE:
        colors.append(ORANGE)
    elif i < RED:
        colors.append(RED)
    else:
        over3200 += 1

colornum = len(set(colors))
mincolor = max(colornum, 1)
maxcolor = colornum + over3200

print(' '.join([str(mincolor),str(maxcolor)]))

Submission status: Accepted

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

n_min = len(set(a2_n))
n_max = n_min+count

print(max(1, n_min),n_max)

Submission status: Accepted

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

N = input()
an = input()
lit = sorted(map(int, an.split()))
color = {}

for i in range(400, 3201, 400):
    color[i] = list(filter(lambda x: i-400 <= x <i , lit))
rainbow = list(filter(lambda x: x>=3200, lit))
label = 0

for v in color.values():
    if len(v) != 0:
        label += 1
        
if label == 0 and len(rainbow) > 0:
    print('1 {}'.format(len(rainbow)))
else:
    print('{} {}'.format(label, label + len(rainbow)))

Submission status: Accepted

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 = 100

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
    max = N
else:
    if len(np.where(a>=3200)[0])==0:
        max = min
    else:
        max = min + len(np.where(a>=3200)[0])
print (min, max)

Submission status: Accepted

Solution code:
import sys
from collections import Counter

# sys.stdin = open("c1.in")


def is_not_zero(x):
    if x != 0:
        return True
    else:
        return False


n = int(input())
a = list(map(int, input().split()))
c = Counter()

for x in a:
    for l in range(0, 3600, 400):
        if x < l:
            c[l] += 1

g = []
for l in range(400, 3600, 400):
    g.append(c[l] - c[l - 400])
r = n - sum(g)

# print('g:', g, '\nr:', r)

res = [0, 0]
# non_zero = list(filter(lambda x: x != 0, g))
non_zero = list(filter(is_not_zero, g))
if len(non_zero) == 0:
    res[0] = 1
    res[1] = r
if len(non_zero) > 0:
    res[0] = len(non_zero)
    res[1] = len(non_zero) + r
print(res[0], res[1])

Submission status: Accepted

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

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

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

s = sum(colors)

print(str(max(s, 1)) + " " + str(s + free))

Submission status: Accepted

Solution code:
# coding: utf-8

N = int(input())
a = list(map(int, input().split()))
flag = [0]*9
ans = 0
ans_max =0
for i in range(N):
    num = a[i]//400
    if num>=8:
        flag[8]+=1
    else:
        flag[num]=1
ans = sum(flag[:-1])
if ans == 0:
    ans =1
    ans_sum = flag[8]
else: 
    ans_sum= ans+flag[8]
    
print(ans, ans_sum)

Submission status: Accepted

Solution code:
def read(): return list(map(int, input().split()))


n = int(input())
a = read()

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

s = sum(c[:8])
mini = 1 if s < 1 else s
maxi = s + c[8]
print("{} {}".format(mini, maxi))

Submission status: Accepted

Solution code:
def get_color(rating):
    return rating / 400

N = input()
a = map(int, raw_input().split())
colors = [get_color(a[i]) for i in range(N)]

S, cnt = set(), 0
for c in colors:
    if c < 8:
        S.add(c)
    else:
        cnt += 1
print max(len(S), 1), (len(S) + cnt)

Submission status: Accepted

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

# static colors [gray, brown, green, water, blue, yellow, orange, red, free]
color_list = [0] * 9


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

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

# do
ans = 0
for i in range(len(a_list)):
    n = check_color(a_list[i])
    if (color_list[n] == 0) & (n <= 7):
        ans += 1
    color_list[n] += 1

min = ans
if (min == 0):
    min = 1
max = ans + color_list[8]
print (str(min) + " " + str(max))

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    a = LI()
    d = set()
    t = 0
    for c in a:
        if c >= 3200:
            t += 1
        else:
            d.add(c//400)
    l = len(d)
    return '{} {}'.format(max(l,1),l+t)


print(main())

Submission status: Accepted

Solution code:
#coding:utf-8

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

if __name__ == "__main__":
    N = int(input())
    rates = list(map(int, input().split(" ")))
    color_list = [0] * 8

    free_num = 0
    for rate in rates:
        if rate >= 3200:
            free_num += 1
        else:
            color_list[get_index(rate)] += 1

    color_kind = len(list(filter(lambda x: x > 0, color_list)))
    if color_kind == 0:
        print(str(1) + " " + str(free_num))
    else:
        print(str(color_kind) + " " + str(color_kind + free_num))

Submission status: Accepted

Solution code:
N = int(raw_input())
a = map(int, raw_input().split())
c = [0] * 9
for r in a:
    if r <= 399:
        c[1] = c[1] + 1
    elif r <= 799:
        c[2] = c[2] + 1
    elif r <= 1199:
        c[3] = c[3] + 1
    elif r <= 1599:
        c[4] = c[4] + 1
    elif r <= 1999:
        c[5] = c[5] + 1
    elif r <= 2399:
        c[6] = c[6] + 1
    elif r <= 2799:
        c[7] = c[7] + 1
    elif r <= 3199:
        c[8] = c[8] + 1
    elif 3200 <= r:
        c[0] = c[0] + 1
ans = 0
for i in c[1:]:
    if i != 0:
        ans = ans + 1
mn = ans
mx = ans + c[0]
if mn == 0:
    print 1, mx
else:
    print mn, mx

Submission status: Accepted

Solution code:
n=int(input())
aa=map(int,input().split())
aa=list(aa)
memo=[]
count=0
for a in aa:
    if a<400:memo.append(1)
    elif a<800:memo.append(2)
    elif a<1200:memo.append(3)
    elif a<1600:memo.append(4)
    elif a<2000:memo.append(5)
    elif a<2400:memo.append(6)
    elif a<2800:memo.append(7)
    elif a<3200:memo.append(8)
    else:count+=1

memo=set(memo)
min=len(memo)
if min==0:min=1
max=len(memo)+count
#if max>8: max=8
print(min,max)

Submission status: Accepted

Solution code:
input()
rates = sorted([int(x) for x in input().split()])
least = 0
for boundary in (399, 799, 1199, 1599, 1999, 2399, 2799, 3199):
    length = len(rates)
    while rates and (rates[0] <= boundary):
        rates.pop(0)
    least += length > len(rates)
print("{} {}".format((least == 0)+least, least+len(rates)))

Submission status: Accepted

Solution code:
input()
rates = sorted([int(x) for x in input().split()])
least = 0
for boundary in [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]:
    least += 1 if rates and (rates[0] <= boundary) else 0
    rates = [rate for rate in rates if rate > boundary]
print("{} {}".format((least == 0)+least, least+len(rates)))

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline())
a  = map(int,stdin.readline().split())
ans = set()
co = 0
for i in a:
 if i < 3200:
  ans.add(i/400)
 else:
  co += 1
print  max(1,len(ans)),len(ans) + co

Submission status: Accepted

Solution code:
input()
rates = sorted([int(x) for x in input().split()])
counts = []
for boundary in [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]:
    counts.append(1 if rates and (rates[0] <= boundary) else 0)
    rates = [rate for rate in rates if rate > boundary]
higher = len(rates)
least = sum(counts)
print("{} {}".format(1 if least == 0 else least, least+higher))

Submission status: Accepted

Solution code:
boundaries = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 4800]
input()
rates = sorted([int(x) for x in input().split()])
counts = []
for boundary in boundaries:
    tmp = 0
    while rates and rates[0] <= boundary:
        tmp += 1
        rates.pop(0)
    counts.append(tmp)
least = sum([x > 0 for x in counts[:-1]])
print("{} {}".format(1 if least == 0 else least, counts[-1]+least))

Submission status: Accepted

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

Solution code:
def c():
    n = int(input())
    a = list(map(int, input().split()))
    l = list(map(lambda i: min(8, i//400), a))
    over_rate = l.count(8)
    res = set(l)
    if 8 in res: res.remove(8)

    mi = max(1, len(res))
    ma = len(res) + over_rate
    print(mi, ma)

c()

Submission status: Accepted

Solution code:
input()
a = list(map(int, input().split()))
b = [0] * 9
for i in a:
    if i < 3200:
        b[int(i / 400)] = 1
    else:
        b[8] = b[8] + 1
mini = sum(b[0:8])
if mini == 0:
    mini = 1
maxi = sum(b[0:8]) + b[8]
print(str(mini) + ' ' + str(maxi))

Submission status: Accepted

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

# 色を返却
def what_color(num):
    if num < 400: #灰色
        return 0
    elif num < 800: #茶色
        return 1
    elif num <1200 : #緑
        return 2
    elif num < 1600: #水色
        return 3
    elif num < 2000: #青
        return 4
    elif num < 2400: #黄色
        return 5
    elif num < 2800: #橙色
        return 6
    elif num < 3200: #赤色
        return 7
    else:
        return 8

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

colors = [0, 0, 0, 0, 0, 0, 0, 0]
god = 0
for rate in a:
    color = what_color(rate)
    if color == 8:
        god = god+1
    else:
        colors[color] = 1

sum_colors = sum(colors)

saidai = sum_colors + god
saisyo = sum_colors
if saisyo == 0:
    saisyo = 1

print '{0} {1}'.format(saisyo, saidai)

Submission status: Accepted

Solution code:
def main():
    N = int(input().strip())

    n_color = [0 for i in range(8)]
    n_free = 0
    rates = list(map(int, input().strip().split()))
    for r in rates:
        if r >= 3200:
            n_free += 1
        else:
            n_color[r // 400] += 1

    n_less_3200 = sum(1 for _ in n_color
                      if _ > 0)

    n_min = max(1, n_less_3200)
    n_max = n_less_3200 + n_free

    print(n_min, n_max)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def c():
    n = int(input())
    a = list(map(int, input().split()))
    # x = []
    def set_col(rate):
        r = rate // 400
        r = min(8, r)
        return r

    l = list(map(set_col, a))
    over_rate = l.count(8)
    res = set(l)
    if 8 in res: res.remove(8)

    mi = max(1, len(res))
    ma = len(res) + over_rate
    print(mi, ma)

c()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N =int(input())
scores = [min(int(i)//400, 8) for i in input().split()]
d = [0]*9
for s in scores:
    d[s] = d[s] + 1
lt3200 = [bool(i) for i in d[:8]].count(True)
m = max(1, lt3200)
M = lt3200+d[8]
print('{} {}'.format(m, M))

Submission status: Accepted

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
daidai = 0
aka = 0

niji = 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 = 1
    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

if mincolor == 0:
    mincolor += 1
    niji -= 1

maxcolor = mincolor + niji

#if maxcolor >= 9:
#    maxcolor = 8

print(mincolor, maxcolor)

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 a[i]/400<=7:
        c[a[i]/400]=1
    else:
        mx+=1
print max(1,sum(c)),sum(c)+mx

Submission status: Accepted

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

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

color = [0] * 8
supercoder = 0
ctn = 0

for i in range(N):
    if ratio[i] <= 399:
        color[0] += 1
    elif ratio[i] <= 799:
        color[1] += 1
    elif ratio[i] <= 1199:
        color[2] += 1
    elif ratio[i] <= 1599:
        color[3] += 1
    elif ratio[i] <= 1999:
        color[4] += 1
    elif ratio[i] <= 2399:
        color[5] += 1
    elif ratio[i] <= 2799:
        color[6] += 1
    elif ratio[i] <= 3199:
        color[7] += 1
    else:
        supercoder += 1

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

if ctn == 0 and supercoder > 0:
    print(1,supercoder)

else:
    print (ctn,ctn + supercoder)

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


s = set()
x = 0
for v in a:
    if v < 3200:
        s.add(int(v / 400))
    else:
        x += 1

y = len(s)
z = x + y

if x > 0:
    y = max(1, y)

print("%d %d" % (y, z))

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
 
COLOR = 8
cnt, ov = [0] * COLOR, 0
for r in a:
    if r < 3200:
        cnt[r // 400] = 1
    else:
        ov += 1

used = 0
for c in cnt:
    if c > 0:
        used += 1

print(max(1, used), used + ov)

Submission status: Accepted

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

def cl(n):
    return n//400

buff=[0]*9

for i in a:
    color=cl(i)
    if color>8:
        color=8
    buff[color]+=1


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

max=min+buff[8]

if min==0:
    min=1

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

Submission status: Accepted

Solution code:
def main():
    N = int(input().strip())

    n_399 = 0
    n_799 = 0
    n_1199 = 0
    n_1599 = 0
    n_1999 = 0
    n_2399 = 0
    n_2799 = 0
    n_3199 = 0
    n_free = 0
    rates = list(map(int, input().strip().split()))
    for r in rates:
        if r <= 399:
            n_399 = 1
        elif r <= 799:
            n_799 = 1
        elif r <= 1199:
            n_1199 = 1
        elif r <= 1599:
            n_1599 = 1
        elif r <= 1999:
            n_1999 = 1
        elif r <= 2399:
            n_2399 = 1
        elif r <= 2799:
            n_2799 = 1
        elif r <= 3199:
            n_3199 = 1
        else:
            n_free += 1

    n_less_3200 = n_399 + n_799 + n_1199 + \
        n_1599 + n_1999 + n_2399 + n_2799 + n_3199
    n_rest = N - n_less_3200

    n_min = n_less_3200
    if n_less_3200 == 0 and n_free > 0:
        n_min = 1

    n_max = n_less_3200 + n_free
    if n_less_3200 + n_free >= N:
        n_max = N

    print(n_min, n_max)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#Python

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

#print A
i=0
free_color_counts=0
colors=[]
while i<N:
	if A[i]>=1 and A[i]<=399:
		c='Hai'
		colors.append(c)
	elif A[i]>=400 and A[i]<=799:
		c='Cha'
		colors.append(c)
	elif A[i]>=800 and A[i]<=1199:
		c='Midori'
		colors.append(c)
	elif A[i]>=1200 and A[i]<=1599:
		c='Mizu'
		colors.append(c)
	elif A[i]>=1600 and A[i]<=1999:
		c='Ao'
		colors.append(c)
	elif A[i]>=2000 and A[i]<=2399:
		c='Ki'
		colors.append(c)
	elif A[i]>=2400 and A[i]<=2799:
		c='Dai'
		colors.append(c)
	elif A[i]>=2800 and A[i]<=3199:
		c='Aka'
		colors.append(c)
	elif A[i]>=3200:
		free_color_counts+=1

	i+=1


#print colors
#print list(set(colors))

if len(list(set(colors)))==0:
	print 1,
	print free_color_counts
else:
	print len(list(set(colors))),
	print len(list(set(colors)))+ free_color_counts

Submission status: Accepted

Solution code:
inf=float('inf')
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
        x[i]=inf
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
 
 
mincolar=0
for i in a:
    if i!=0:
        mincolar +=1
if mincolar!=0:
    print(mincolar,mincolar+b)
else:
    print(1,b)
quit()

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
choice=0
colour={}
for elements in a:
	if elements>=1 and elements<=399:colour[1]=1
	elif elements>=400 and elements<=799:colour[2]=2
	elif elements>=800 and elements<=1199:colour[3]=3
	elif elements>=1200 and elements<=1599:colour[4]=4
	elif elements>=1600 and elements<=1999:colour[5]=5
	elif elements>=2000 and elements<=2399:colour[6]=6
	elif elements>=2400 and elements<=2799:colour[7]=7
	elif elements>=2800 and elements<=3199:colour[8]=8
	else:choice+=1

m=len(colour)
if m==0 and choice!=0:m=1
print(m,len(colour)+choice)

Submission status: Accepted

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

Solution code:
N=int(input())
gray=0
brown=0
green=0
cyan=0
blue=0
yellow=0
dai=0
red=0
chan=0
A=input().split()
for i in range(N):
    a=int(A[i])
    if a<400:
        gray=1    
    elif a<800:
        brown=1
    elif a<1200:
        green=1   
    elif a<1600:
        cyan=1
    elif a<2000:
        blue=1
    elif a<2400:
        yellow=1
    elif a<2800:
        dai=1
    elif a<3200:
        red=1    
    else:
        chan=chan+1
min=gray+brown+green+cyan+blue+yellow+dai+red
 
 
if chan==0:
   print(str(min)+' '+str(min))
else:
   max=min+chan
   if min==0:
      min=1
   print(str(min)+' '+str(max))

Submission status: Accepted

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

num=[0,0,0,0,0,0,0,0,0]
counter=0

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

for i in range(0,8):
    if num[i]!=0:
        counter+=1

if counter==0 and num[8]==0:
    min=0
    max=0

elif counter==0 and num[8]!=0:
    min=1
    max=num[8]

else:
    min=counter
    max=counter+num[8]

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
 
COLOR = 8
cnt, ov = [0] * COLOR, 0
for i in range(N):
    if a[i] < 3200:
        cnt[a[i] // 400] += 1
    else:
        ov += 1
 
used = 0
for c in cnt:
    if c > 0:
        used += 1

unused = N - used 
print(max(1, used), used + min(unused, ov))

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
 
COLOR = 8
cnt, ov = [0] * COLOR, 0
for r in a:
    if r < 3200:
        cnt[r // 400] = 1
    else:
        ov += 1

used = 0
for c in cnt:
    if c > 0:
        used += 1

unused = N - used

print(max(1, used), used + min(unused, ov))

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
a = np.array(list(map(int, input().split())))

c = np.array([0] * 8)

a //= 400

for i in range(8):
    num = np.sum(a == i)
    c[i] = num
red = np.sum(a >= 8)


mincol = np.sum(c != 0)
maxcol = mincol + red
if mincol == 0:
    mincol = 1

print(mincol, maxcol)

Submission status: Accepted

Solution code:
#!/usr/bin/python

n = input()
a = [int(i) for i in input().split()]
color = [0, 0, 0, 0, 0, 0, 0, 0]
tr = 0

for i in a:
  if i < 3200 and color[int(i/400)] == 0:
    color[int(i / 400)] = 1
  elif i >= 3200:
    tr += 1

color_kind = 0
for i in color:
  if i == 1:
    color_kind += 1

if color_kind > 0:
  print(str(color_kind) + " ", end = '')
else:
  print(str(1) + " ", end = '')

print(str(color_kind + tr))

Submission status: Accepted

Solution code:
import sys
import numpy as np
from math import *
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    color_list = [0 for i in range(8)]
    top_coder_num = 0
    for i in range(N):
        rate = int(input_raw[i])
        if rate>= 1 and rate < 400:
            color_list[0] = 1
        elif rate>= 400 and rate < 800:
            color_list[1] = 1
        elif rate>= 800 and rate < 1200:
            color_list[2] = 1
        elif rate>= 1200 and rate < 1600:
            color_list[3] = 1
        elif rate>= 1600 and rate < 2000:
            color_list[4] = 1
        elif rate>= 2000 and rate < 2400:
            color_list[5] = 1
        elif rate>= 2400 and rate < 2800:
            color_list[6] = 1
        elif rate>= 2800 and rate < 3200:
            color_list[7] = 1
        elif rate >= 3200:
            top_coder_num += 1

    min_color = sum(color_list)
    if min_color == 0 and top_coder_num >= 1:
        min_color = 1
    max_color = sum(color_list) + top_coder_num

    print min_color, max_color




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
def get_ln_int_inputs():
    return list(map(int, input().split()))


def main():
    input()
    rates = get_ln_int_inputs()

    colors = [0] * 8
    free_colors = 0
    for rate in rates:
        if rate >= 3200:
            free_colors += 1
        else:
            colors[rate // 400] = 1
    fixed_colors = sum(colors)

    print(str(max(fixed_colors, 1)) + " " + str(max(fixed_colors + free_colors, 1)))


main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 26 01:33:48 2017

@author: kenta
"""

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

hai = 0;cha = 0;midori = 0; mizu = 0;ao = 0;ki = 0;dai = 0;aka = 0;ue=0
for i in range(N):
    if 1<= a[i] < 400:
        hai +=1
    elif 400<= a[i] < 800:
        cha += 1
    elif 800<= a[i] < 1200:
        midori += 1
    elif 1200<= a[i] < 1600:
        mizu += 1
    elif 1600<= a[i] < 2000:
        ao += 1    
    elif 2000<= a[i] < 2400:
        ki += 1 
    elif 2400<= a[i] < 2800:
        dai += 1
    elif 2800<= a[i] < 3200:
        aka += 1
    else:
        ue += 1

count1 = 0
if hai > 0:
    count1 += 1
if cha > 0:
    count1 += 1
if midori> 0:
    count1 += 1
if mizu > 0:
    count1 += 1
if ao > 0:
    count1 += 1
if ki > 0:
    count1 += 1
if dai > 0:
    count1 += 1
if aka > 0:
    count1 += 1

countmin = count1
if countmin == 0:
    if ue >0:
        countmin += 1
countmax = count1+ue
print("{} {}".format(countmin, countmax))