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: Wrong Answer

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)
mx = mn + wild
print mn,mx

Submission status: Wrong Answer

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
print sum(num[:-1]), sum(num)

Submission status: Wrong Answer

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)

print mini, maxi

Submission status: Wrong Answer

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])
print len(b)
print len(b) + cnt

Submission status: Wrong Answer

Solution code:
# coding: utf-8
def get_ln_inputs():
    return input().split()


def get_ln_int_inputs():
    return list(map(int, get_ln_inputs()))


def main():
    _ = get_ln_int_inputs()
    rates = get_ln_int_inputs()
    colors = list()
    free_colors = 0

    for _ in range(8):
        colors.append(0)
    
    for i in range(len(rates)):
        rate = rates[i]
        if rate >= 3200:
            free_colors += 1
        else:
            colors[rate // 400] += 1

    for i in range(8):
        colors[i] = min(colors[i], 1)

    print(str(sum(colors)) + " " + str(sum(colors) + free_colors))


main()

Submission status: Wrong Answer

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])
print cnt
print len(b)
print len(b) + cnt

Submission status: Wrong Answer

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 >= count[8]:
        ans_min = num_else
    else:
        ans_min = count[8]

    if ans_min == 0:
        ans_min = 1

    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: Wrong Answer

Solution code:


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


def free(dic):
    return dic[0]


def nonzero(dic):
    ret = 0
    for k, v in dic.items():
        if v != 0:
            ret += 1
    return ret


n = int(input())
a = list(map(int, input().split()))
c = [assign(e) for e in a]

dic = {i: 0 for i in range(9)}
for e in c:
    if e == -1:
        dic[0] += 1

    else:
        dic[e] = 1

a = free(dic)
b = nonzero(dic)

print('{} {}'.format(b-a, b+a))

Submission status: Wrong Answer

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), min(8, res2 + d['above']))

Submission status: Wrong Answer

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
print(len(dic),ans+len(dic))

Submission status: Wrong Answer

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]
unique = len(set(x))
dora = x.count(8)
min_ = unique if dora == 0 else unique - 1
max_ = unique if dora == 0 else unique - 1 + dora
print(min_, max_)

Submission status: Wrong Answer

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
print(len(set(arr)), len(set(arr)) + count,sep = ' ')

Submission status: Wrong Answer

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
'''

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(ans, ans + extra)

Submission status: Wrong Answer

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)
mx = min(8, mn+wild)
print mn,mx

Submission status: Wrong Answer

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
'''

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(ans, min(ans + extra, 8))

Submission status: Wrong Answer

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) + min(8 - len(C), c)

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

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

Submission status: Wrong Answer

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(mn, mx)

Submission status: Wrong Answer

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 = set(C)

m = len(C) + min(8 - len(C), c)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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]
unique = len(set(x))
dora = x.count(8)
min_ = unique if dora == 0 else unique - 1
max_ = unique if dora == 0 else min(8, unique - 1 + dora)
print(min_, max_)

Submission status: Wrong Answer

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:
	min -=1
	max = min + pts[8]
else:
	max = min

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

Submission status: Wrong Answer

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 = min(mini + joker, 8)

print mini, maxi

Submission status: Wrong Answer

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 range(8):
    if c[i] > 0:
        ans+=1


print ans,ans+m

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
a=map(int,raw_input().split())
c=[0]*9
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 sum(c),sum(c)+mx

Submission status: Wrong Answer

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
    
    ans = sum(count)
    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
def get_ln_inputs():
    return input().split()


def get_ln_int_inputs():
    return list(map(int, get_ln_inputs()))


def main():
    _ = get_ln_int_inputs()
    rates = get_ln_int_inputs()
    colors = list()
    for _ in range(9):
        colors.append(0)
    
    for rate in rates:
        if rate >= 3200:
            colors[8] += 1
        else:
            colors[rate // 400] += 1

    for i in range(8):
        if colors[i] != 0:
            colors[i] = 1
    
    print(str(sum(colors[:8])) + " " + str(sum(colors)))


main()

Submission status: Wrong Answer

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) - int(8 in a)
print(m, m + a[8])

Submission status: Wrong Answer

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 = min(sum(cnts), 8)
print mi, ma

Submission status: Wrong Answer

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

print m, m + cnt[-1]

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int,input().split()))
exc = []
ls = []
for a in A:
    if a < 3200:
        ls.append(a)
    else:
        exc.append(a)
rates = [list(range(1,400))]+[list(range(400*i,400*i+399)) for i in range(1, 8)]
vars = [False]*8
for r in ls:
    for j in range(8):
        if r in rates[j]:
            vars[j] = True
if ls == []:
    print(1, min(len(exc), 8))
else:
    ans = vars.count(True)
    if exc == []:
        print(ans, ans)
    else:
        while True:
            ans = 0
        print(ans, min(ans+len(exc), 8))

Submission status: Time Limit Exceeded

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]
ma=mi
if b[8]>0:
    ma+=b[8]
if b[8]>8:
    ma=8
print (mi+" "+ma)

Submission status: Accepted

Solution code:
# coding: utf-8


def main():
    _ = int(input())
    A = list(map(int, input().split()))
    B = [0] * 9
    mn, mx = 0, 0

    for a in A:
        a //= 400
        if a > 7: a = 8
        B[a] += 1
    
    for i in range(8):
        if B[i] > 0: mn += 1
    
    mx = mn + B[8]
    if mn == 0: mn += 1

    print(mn, mx)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A=list(map(int, input().split()))
ls = [0]*9
for i in range(N):
    if 1 <= A[i] <= 399:
        ls[0] += 1
    elif 400 <= A[i] <= 799:
        ls[1] += 1
    elif 800 <= A[i] <= 1199:
        ls[2] += 1
    elif 1200 <= A[i] <= 1599:
        ls[3] += 1
    elif 1600 <= A[i] <= 1999:
        ls[4] += 1
    elif 2000 <= A[i] <= 2399:
        ls[5] += 1
    elif 2400 <= A[i] <= 2799:
        ls[6] += 1
    elif 2800 <= A[i] <= 3199:
        ls[7] += 1
    else:
        ls[8] += 1
c = 0
for i in range(8):
    if ls[i]:
        c += 1
m = c if c > 0 else int(ls[-1]>0)
M = c + ls[-1]
print(m, M)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
d = {}

A.sort()
irregular_cnt=0
reg_cnt = 0
for i in range(n):
    a = A[i]
    a //= 400
    if a>7:
        irregular_cnt += 1
    else:
        d[a] = d.get(a, 0)+1

maxi, mini = 0, 0
for i in d:
    if d[i]>0:
        maxi += 1
        mini += 1
if irregular_cnt:
    maxi += irregular_cnt
    if not mini:
        mini += 1
print(mini, maxi)

Submission status: Accepted

Solution code:
N,*A=map(int,open(0).read().split())

colors = [0 for i in range(8)]
tyty = 0

for a in A:
  c = a//400
  if c>=8:
    tyty+=1
  else:
    colors[c]+=1

cNum = 8-colors.count(0)
    
minC = max(cNum,1)
maxC = cNum+tyty

print(minC,maxC)

Submission status: Accepted

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


def check(a):
    if a < 400:
        return 0
    elif a < 800:
        return 1
    elif a < 1200:
        return 2
    elif a < 1600:
        return 3
    elif a < 2000:
        return 4
    elif a < 2400:
        return 5
    elif a < 2800:
        return 6
    elif a < 3200:
        return 7
    else:
        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, top)
else:
    print(ans, ans+top)

Submission status: Accepted

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

arr = [0] * 9
ans = [0] * 2

for i in a:
    if i//400 < 8:
        arr[i//400] = 1
    else:
        arr[8] += 1

left = sum(arr[:8])
right = arr[8]

ans[0] = left

if left == 0:
    ans[0] = 1

ans[1] = left + right

print(*ans)

Submission status: Accepted

Solution code:
def cordtest(AAA):
  jisyo ={'H':0,'C':0,'G':0,'M':0,'B':0,'Y':0,'O':0,'R':0,'A':0}
  for i in AAA:
    
    if i <= 399:
      jisyo['H'] +=1
    elif 400 <= i <=799:
      jisyo['C'] +=1
    elif 800 <= i <=1199:
      jisyo['G'] +=1
    elif 1200 <= i <=1599:
      jisyo['M'] +=1
    elif 1600 <= i <=1999:
      jisyo['B'] +=1
    elif 2000 <= i <=2399:
      jisyo['Y'] +=1
    elif 2400 <= i <= 2799:
      jisyo['O'] +=1
    elif 2800 <= i <= 3199:
      jisyo['R'] +=1
    else:
      jisyo['A'] +=1
  maxi = 0
  mini = 0
  for i,j in jisyo.items():
    
    if i != 'A':
      if j >0:
        mini +=	1
    else:
      maxi += j
  ans = maxi + mini
  if mini ==0:
    mini =1
  
  return print(mini,ans)
N = int(input())
AA = list(map(int,input().split()))
cordtest(AA)

Submission status: Accepted

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 = sum(c)
print(cmin, cmax)

Submission status: Accepted

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

l = [0,0,0,0,0,0,0,0,0]


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

if n == 1 and a[0] >= 3200:
  print(1,1)
  exit()
  
for i in range(len(l)-1):
  if l[i] > 0:
    ans += 1

if ans >= 1:
  print(ans,ans + l[8])
elif ans == 0:
  print(1,l[8])

Submission status: Accepted

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
min_p= (Number_NRD,1)[Number_NRD == 0]
print(str(min_p) + " " + str(max_p))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 22 04:19:50 2020

@author: liang
"""

N = int(input())
A = [int(x) for x in input().split()]
d = [False]*8
count = 0
ans = 0
for a in A:
    if a//400 >= 8:
        count += 1
    else:
        if d[a//400] == False:
            ans += 1
            d[a//400] = True

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

Submission status: Accepted

Solution code:
n = int(input())
al = list(map(int, input().split()))
ratel = [0,0,0,0,0,0,0,0,0]

def check(a):
    if 1 <= a <= 399:
        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
    else:
        return 8

for a in al:
    i = check(a)
    ratel[i] += 1


zeroc = 0
ratec = 0
for i in range(8):
    if ratel[i] == 0:
        zeroc += 1
    else:
        ratec += 1

if ratel[8] == 0:
    print(ratec,ratec)
elif 1 <= ratel[8] <= 8:
    if ratec == 0:
        print(1,ratel[8])
    elif ratel[8] < zeroc:
        print(ratec, ratec+ratel[8])
    elif ratel[8] >= zeroc:
        print(ratec,ratec+ratel[8])
else:
    if ratec == 0:
        print(1,ratel[8])
    else:
        print(ratec,ratec+ratel[8])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = [i // 400 for i in A if i < 3200]
if B == []:
  print(1, N)
elif len(B) == N:
  C = len(set(B))
  print(C, C)
else:
  C = len(set(B))
  D = C + N - len(B)
  print(C, D)

Submission status: Accepted

Solution code:
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    n = i_input()
    a = i_list()
    dic = {399:0, 799:0, 1199:0, 1599:0, 1999:0, 2399:0, 2799:0, 3199:0}
    cnt = 0
    for i in a:
        if i < 400:
            dic[399] = 1
        elif i < 800:
            dic[799] = 1
        elif i < 1200:
            dic[1199] = 1
        elif i < 1600:
            dic[1599] = 1
        elif i < 2000:
            dic[1999] = 1
        elif i < 2400:
            dic[2399] = 1
        elif i < 2800:
            dic[2799] = 1
        elif i < 3200:
            dic[3199] = 1
        else:
            cnt += 1
    c = sum(list(dic.values()))
    if c == 0:
        print(1, cnt)
    else:
        print(c, c+cnt)





if __name__=="__main__":
    main()

Submission status: Accepted

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

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

print(max(1, counter), counter + rate[8])

Submission status: Accepted

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

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


print(max(1, counter), counter + rate[8])

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())
rate = [0] * 9
for v in map(int, input().split()):
    if v // 400 < 8:
        rate[v // 400] = 1
    else:
        rate[8] += 1

ans = sum(rate[:8])
if ans == 0:
    print('1 {}'.format(rate[8]))
elif rate[8] == 0:
    print('{} {}'.format(ans, ans))
else:
    print('{} {}'.format(ans, ans + rate[8]))

Submission status: Accepted

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

color = []
rainbow = 0

for i in range(N):
    if 1 <= a[i] <= 399:
        color.append('gray')
    elif 400 <= a[i] <= 799:
        color.append('brown')
    elif 800 <= a[i] <= 1199:
        color.append('green')
    elif 1200 <= a[i] <= 1599:
        color.append('sky')
    elif 1600 <= a[i] <= 1999:
        color.append('blue')
    elif 2000 <= a[i] <= 2399:
        color.append('yellow')
    elif 2400 <= a[i] <= 2799:
        color.append('orange')
    elif 2800 <= a[i] <= 3199:
        color.append('red')
    else:
        rainbow += 1
        color.append('all')

if len(set(color)) == 1 and rainbow > 0:
    mini = 1
elif rainbow == 0:
    mini = len(set(color))
else:
    mini = max(1, len(set(color))-1)

if rainbow > 1:
    maxi = len(set(color)) + rainbow - 1
else:
    maxi = len(set(color))

print(mini, maxi)

Submission status: Accepted

Solution code:
N = int(input())
data = [0 for _ in range(9)]
a = list(map(int, input().split()))
for i in range(N):
    x = a[i]
    if 0 <= x <= 399:
        data[0] = 1
    elif 400 <= x <= 799:
        data[1] = 1
    elif 800 <= x <= 1199:
        data[2] = 1
    elif 1200 <= x <= 1599:
        data[3] = 1
    elif 1600 <= x <= 1999:
        data[4] = 1
    elif 2000 <= x <= 2399:
        data[5] = 1
    elif 2400 <= x <= 2799:
        data[6] = 1
    elif 2800 <= x <= 3199:
        data[7] = 1
    else:
        data[8] += 1

Sum = 0
for i in range(8):
    if data[i] != 0:
        Sum += 1
m = max(1, Sum)
M = Sum + data[8]

print(m,M)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
L = []
H = []

for i in range(N):
  a = A[i]//400
  if a > 7:
    H.append(a)
  else:
    L.append(a)

if len(L) != 0:
  print(str(len(set(L)))+" "+str(len(set(L))+len(H)))
else:
  print("1 "+str(len(H)))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
colors = [0] * 8
other = 0
for a in A:
  index = a // 400
  if index > 7:
    other += 1
  else:
    colors[index] += 1
min_color = 0
max_color = 0
# 全員3200以上の場合
if other == N:
  min_color = 1
  max_color = other
else:
  for c in colors:
    if c != 0:
      min_color += 1
  max_color = min_color + other 

print(min_color,max_color)