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:
import sys
iN = int(input())
aA = [int(_)//400 for _ in input().split()]

aCol = [0]*(4800//400 +1)
for a in aA:
    aCol[a] += 1
iMin = 0
for i in range(8):
    if aCol[i]:
        iMin += 1
iMax = iMin + sum(aCol[8:])
if iMin == 0:
    iMin = 1
print(iMin,iMax)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
b = []
rainbow = 0
for i in range(N):
    if a[i] >= 3200:
        rainbow += 1
    else:
        b.append(a[i]//400)
color = set(b)
min = len(color)
max = min + rainbow
if rainbow == N:
    min = 1

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
n = int(input())
va = list(map(int, input().split()))

res = set()
cnt = 0
for a in va:
    if a // 400 < 8:
        res.add(a // 400)
    else:
        cnt += 1

if len(res) == 0:
    print(1, cnt)
else:
    print(len(res), len(res) + cnt)

Submission status: Accepted

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

for i in range(8):
    if color[i] != 0:
        minmum += 1
        maximum += 1
        
if minmum == 0:
    minmum += 1

maximum += color[8]
print(str(minmum) + ' ' + str(maximum))

Submission status: Accepted

Solution code:
def process(N, A):
    rates = set()
    over_rates = 0
    for a in A:
        a //= 400
        if a < 8:
            rates.add(a)
        else:
            over_rates += 1
    minimum = max(len(rates), 1)
    maximum = len(rates) + over_rates
    return minimum, maximum

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

minimum, maximum = process(N, A)
print(minimum, maximum)

Submission status: Accepted

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

if counter == 0:
    print("1 " + str(rate[-1]))
else:
    print(str(counter) + " " + str(counter + rate[-1]))

Submission status: Accepted

Solution code:
def solve(N, As):
    colors = set()
    allcount = 0
    for a in As:
        n = a // 400
        if n < 8:
            colors.add(n)
        else:
            allcount += 1
    return max(len(colors), 1), len(colors) + allcount


if __name__ == "__main__":
    N = int(input())
    As = map(int, input().split(" "))
    m1, m2 = solve(N, As)
    print(m1, m2)

Submission status: Accepted

Solution code:
def solve(N, As):
    colors = set()
    allcount = 0
    for a in As:
        a -= a % 400
        n = a // 400
        if n < 8:
            colors.add(n)
        else:
            allcount += 1
    return max(len(colors), 1), len(colors) + allcount


if __name__ == "__main__":
    N = int(input())
    As = map(int, input().split(" "))
    m1, m2 = solve(N, As)
    print(m1, m2)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
an = list(map(int, input().split()))

col = {x:0 for x in range((4800//400) + 1)}
for ai in an:
    col[ai//400] +=1

cnt1 = 0
cnt2 = 0
for k,v in col.items():
    if v > 0:
        if k < 8:
            cnt1 += 1
        else:
            cnt2 += v

print(max([cnt1,1]),cnt1+cnt2)

Submission status: Accepted

Solution code:
def inpl(): return [int(i) for i in input().split()]

H = set([])
N = int(input())
a = inpl()
sugoi = 0

for i in range(N):
    if a[i] < 400:
        H.add('gray')
    elif a[i] < 800:
        H.add('brown')
    elif a[i] < 1200:
        H.add('green')
    elif a[i] < 1600:
        H.add('sky')
    elif a[i] < 2000:
        H.add('blue')
    elif a[i] < 2400:
        H.add('yellow')
    elif a[i] < 2800:
        H.add('orange')
    elif a[i] < 3200:
        H.add('red')
    else:
        sugoi += 1

ans = [max(len(H),1),max(len(H)+sugoi,1)]
print(*ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#	ABC 064: C [beta]

N = int(input())

scores = list(map(int, input().split()))
for i in range(N):
  scores[i] = scores[i] // 400
  if scores[i] > 8:
    scores[i] = 8

color=0

for i in range(8):
  if i in scores:
    color += 1
    
free = scores.count(8)

max_colors = color+ free

if color == 0:
  color += 1

print(color, max_colors)

Submission status: Accepted

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

abv3200 = 0 # count for above 3200
colors = set([])
for ai in a:
    if ai//400 >= 8:
        abv3200 += 1
    else:
        colors.add(ai//400)
    
min_colors = len(colors) if len(colors)>0 else 1
max_colors = len(colors) + abv3200
print(min_colors, max_colors)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
c = [0]*8
d = 0
for x in a:
  for i in range(8):
    if x < 400*(i+1):
      c[i] = 1
      break
  if x >= 3200:
    d += 1
s = sum(c)
print(max(s,1), s+d)

Submission status: Accepted

Solution code:
from collections import defaultdict
N = int(input())
A = [int(i) for i in input().split()]

def upper(x):
    if x < 3200:
        return (x//400 + 1) * 400 -1
    else:
        return 3200

Rate = defaultdict(int)
for a in A:
    Rate[upper(a)] += 1

ans = 0
for r in Rate:
    if r < 3200:
        ans += 1
if ans > 0:
    print(ans, ans + Rate[3200])
else:
    print(1, Rate[3200])

Submission status: Accepted

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

nums = [0 for _ in range(8)]
over = 0

for i in A:
    if i >= 3200:
        over += 1
    else:
        nums[i // 400] += 1

cnt = 0
for i in range(len(nums)):
    if nums[i] >= 1:
        cnt += 1
        
print(max(1,cnt), cnt + over)

Submission status: Accepted

Solution code:
def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))

n = getN()
nums = getList()
rainbow = 0
colors = [0 for i in range(8)]
for n in nums:
    if n >= 3200:
        rainbow+=1
    else:
        grade = n//400
        if colors[grade] == 0:
            colors[grade] = 1

clnum = sum(colors)
ansmin = max(1, clnum)
ansmax = clnum+rainbow


print(ansmin,ansmax)

Submission status: Accepted

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

cnt = [0 for _ in range(8)]
over = 0

for a in A:
    if a < 3200:
        ind = a//400
        cnt[ind] = 1
    else:
        over += 1


ans = sum(cnt)

ans_min = max(1,ans)
ans_max = ans + over
# if over != 0:
#     ans_min = max(ans,1)
#     ans_max = min(8,ans+over
# else:
#     ans_min = ans
#     ans_max = ans
print(ans_min, ans_max)

Submission status: Accepted

Solution code:
color_used = [0 for i in range(9)]

N = int(input())
a = [int(i) for i in input().split()]
for i in range(N):
    for j in range(1,9):
        if a[i] < 400*j:
            color_used[j-1] += 1
            break
    else:
        color_used[8] += 1

c = 0
for i in range(8):
    if color_used[i]:
        c += 1
# ma = min(8, c+color_used[8])
ma = c+color_used[8]
mi = max(c, 1)

print(mi, ma)

Submission status: Accepted

Solution code:
col = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 5000]
nums = [0 for _ in range(9)]
N = int(input())
a = list(map(int, input().split()))
for x in a:
    for i in range(9):
        if x < col[i]:
            nums[i] += 1
            break
cnt = 0
for i in range(8):
    if nums[i] > 0:
        cnt += 1
print(max(cnt, 1), cnt+nums[8])

Submission status: Accepted

Solution code:
n = int(input())
list_a = list(map(int, input().split()))
dict_a = {}
for number in list_a:
    try:
        dict_a[number//400] += 1
    except KeyError:
        dict_a[number//400] = 1
count = 0
count_niji = 0
for key,value in dict_a.items():
    if key < 8:
        count += 1
    else:
        count_niji += value
if count == 0:
    print(1,count_niji)
else:
    print(count,count + count_niji)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
    a[i] = min(a[i], 3200)
    b.append(a[i] // 400)
b = sorted(b)
if 8 in b:
    free = b.count(8)
    b_max = len(set(b[:-free])) + free
    print("{} {}".format(max(len(set(b)) - 1, 1), b_max))
else:
    print("{} {}".format(len(set(b)), len(set(b))))

Submission status: Accepted

Solution code:
n = int(input())
listA = list(map(int, input().split()))
colorL = [0, 0, 0, 0, 0, 0, 0, 0]
min=0
max=0
index=0
while index < len(listA):
    if listA[index] >0 and listA[index]<400 and colorL[0]==0:
        colorL[0]=1
        min+=1
        max+=1
    elif listA[index] >399 and listA[index]<800 and colorL[1]==0:
        colorL[1]=1
        min += 1
        max += 1
    elif listA[index] > 799 and listA[index] < 1200 and colorL[2] == 0:
        colorL[2] = 1
        min += 1
        max += 1
    elif listA[index] > 1199 and listA[index] < 1600 and colorL[3] == 0:
        colorL[3] = 1
        min += 1
        max += 1
    elif listA[index] > 1599 and listA[index] < 2000 and colorL[4] == 0:
        colorL[4] = 1
        min += 1
        max += 1
    elif listA[index] > 1999 and listA[index] < 2400 and colorL[5] == 0:
        colorL[5] = 1
        min += 1
        max += 1
    elif listA[index] > 2399 and listA[index] < 2800 and colorL[6] == 0:
        colorL[6] = 1
        min += 1
        max += 1
    elif listA[index] > 2799 and listA[index] < 3200 and colorL[7] == 0:
        colorL[7] = 1
        min += 1
        max += 1
    elif listA[index] > 3199:
        max+=1
    index+=1
if min ==0:
    min=1
print(str(min)+" "+str(max))

Submission status: Accepted

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

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

if a.count(8) > 0:
    print(max(len(set(a))-1,1),len(set(a)) -1 +a.count(8))
else:
    print(len(set(a)),len(set(a)))

Submission status: Accepted

Solution code:

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

colors = [0 for i in range(8)]
special = 0
for i in range(N):
    if a[i]<3200:
        if colors[int(a[i]/400)]==0:
            colors[int(a[i]/400)]=1
    else:
        special += 1
if sum(colors)==0:
    print str(1) + " " +str(special)      
else:
    print str(sum(colors)) + " " +str(sum(colors)+special)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
hai, tya, midori = 0, 0, 0
miz, ao, ki = 0, 0, 0
yanagi, aka, got = 0, 0, 0

for i in a:
  if i<=399:
    hai = 1
  elif i<=799:
    tya = 1
  elif i<=1199:
    midori = 1
  elif i <= 1599:
    miz = 1
  elif i <= 1999:
    ao = 1
  elif i <= 2399:
      ki = 1
  elif i <= 2799:
      yanagi = 1
  elif i <= 3199:
      aka = 1
  elif i <= 4800:
    got += 1
minn = hai+tya+midori+miz+ao+ki+yanagi+aka
maxx = minn+got
if minn==0:
    minn = 1
print(minn, maxx)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
ths = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200] 
n_color = [0]*8
n_super = 0
for ai in a:
    for i, th in enumerate(ths):
        if ai < th:
            n_color[i] = 1
            break

    if ai >= 3200:
        n_super += 1

minc = sum(n_color)
maxc = minc + n_super
if minc == 0:
    minc = 1
print(minc, maxc)

Submission status: Accepted

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

s = set()
count = 0
for i in range(n):
    if a[i] // 400 >= 8:
        count += 1
    else:
        s.add(a[i]//400)

print(len(s) if len(s) > 0 else 1, len(s)+count)

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = list(li())

rate = [0]*9

for ai in a:
    if ai < 3200:
        rate[ai//400] = 1
    else:
        rate[8] += 1
        
if sum(rate[:-1]) == 0:
    print(1,rate[8])
    
else:
    print(sum(rate[:-1]), sum(rate[:-1])+rate[8])

Submission status: Accepted

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

fixed = [0] * 8
free = 0
for a in src:
    if a < 3200:
        fixed[a//400] = 1
    else:
        free += 1

mn = max(1, sum(fixed))
mx= sum(fixed) + free
print(mn,mx)

Submission status: Accepted

Solution code:
na = lambda: list(map(int, input().split()))
n = int(input())
a = na()
ans = set()
pro = 0
for i in a:
    if i >= 3200:
        pro += 1
        continue
    ans.add(i // 400)
print(len(ans) if len(ans) > 0 else 1,  len(ans)+pro)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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

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

    n = 8 - ans.count(0)
    print(max(1, n), n + ex)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

def add_rates(i):
    if i not in rates:
        rates[i] = 1
    else:
        rates[i] += 1

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

cnt = len(rates)
if 8 not in rates:
    print(cnt, cnt)
else:
    if cnt == 1:
        print(1, rates[8])
    else:
        print(cnt-1, cnt-1+rates[8])

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
c = [0 for i in range(8)]
cnt = 0
for i in a:
    if i >= 3200:
        cnt += 1
    else:
        c[i // 400] = 1
maxim = sum(c) + cnt
minim = max([1, sum(c)])
print(minim, maxim)

Submission status: Accepted

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

color_set = set()
all = 0

for a in a_list:
    if 1 <= a <= 399:
        color_set.add("gray")
    elif 400 <= a <= 799:
        color_set.add("brown")
    elif 800 <= a <= 1199:
        color_set.add("green")
    elif 1200 <= a <= 1599:
        color_set.add("lightblue")
    elif 1600 <= a <= 1999:
        color_set.add("blue")
    elif 2000 <= a <= 2399:
        color_set.add("yellow")
    elif 2400 <= a <= 2799:
        color_set.add("orange")
    elif 2800 <= a <= 3199:
        color_set.add("red")
    else:
        all += 1
print(max(len(color_set),1), all+len(color_set))

Submission status: Accepted

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


N = int(input())

a = [color(int(i)) for i in input().split()]
ans = 0
table = [False for i in range(10)]
for i in a:
    if i == 8:
        ans += 1
    else:
        table[i] = True

ret = 0
for f in table:
    if f:
        ret += 1

ans1 = max(ret,1)
ans2 = ret+ans

print(ans1,ans2)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
count=0
countall=0
hflag=0
tflag=0
gflag=0
wflag=0
bflag=0
yflag=0
dflag=0
rflag=0
for i in a:
    if 1<= i <=399 and hflag==0:
        count+=1
        hflag=1
    elif 400 <=i<=799 and tflag==0:
        count+=1
        tflag=1
    elif 800<=i<=1199 and gflag==0:
        count+=1
        gflag=1
    elif 1200<=i<=1599 and wflag==0:
        count+=1
        wflag=1
    elif 1600<=i<=1999 and bflag==0:
        count+=1
        bflag=1
    elif 2000<=i<=2399 and yflag==0:
        count+=1
        yflag=1
    elif 2400<=i<=2799 and dflag==0:
        count+=1
        dflag=1
    elif 2800<=i<=3199 and rflag==0:
        count+=1
        rflag=1
    elif i>=3200:
        countall+=1
if count==0:
    print("{} {}".format(1,count+countall))
else:
    print("{} {}".format(count,count+countall))

Submission status: Accepted

Solution code:
N = int( input())
A = list( map( int, input().split()))
C = [0]*8
col = 0
for a in A:
    for i in range(8):
        if a < (i+1)*400:
            C[i] = 1
            break
    else:
        col += 1
if sum(C) == 0:
    print("{} {}".format( 1, col))
else:
    print("{} {}".format( sum(C), sum(C)+col))

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
count = [0 for _ in range(9)]
for i in range(n):
    if A[i] // 400 >= 8:
        count[8] += 1
    elif count[A[i] // 400] == 0:
        count[A[i] // 400] += 1

if count[8] == sum(count):
    print(1, sum(count))
else:
    print(sum(count)-count[8], sum(count))

Submission status: Accepted

Solution code:
#ABC064C
N=int(input())
a=list(map(int, input().split()))
count=[0]*9
for i in range(N):
    if a[i]//400>=8:
        count[8]+=1
    elif count[a[i]//400]==0:
        count[a[i]//400]+=1
if count[8]==sum(count):
    print(1, sum(count))
else:
    print(sum(count)-count[8], sum(count))

Submission status: Accepted

Solution code:
from collections import Counter
N=int(input())
A=list(map(int, input().split()))
for i in range(N):
    A[i]=0 if A[i]>=3200 else A[i]//400+1
print((len(Counter(A))-(0 in Counter(A)))**(len(Counter(A))>(0 in Counter(A))), Counter(A)[0]+(len(Counter(A))-(0 in Counter(A))))

Submission status: Accepted

Solution code:
from collections import Counter
N=int(input())
A=list(map(int, input().split()))
for i in range(N):
    A[i]=0 if A[i]>=3200 else A[i]//400+1
c=len(Counter(A))-(0 in Counter(A))
n=Counter(A)[0]
print(c if c else 1, n+c)

Submission status: Accepted

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

col = set()
wildc = 0

for i in range(N):
  if A[i] >= 3200:
    wildc += 1
  else:
    col.add(A[i] // 400)

a = len(col) if len(col) > 0 else 1
b = len(col)+wildc
print(a, b)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = 0
c = set()
for i in range(n):
    k = a[i]//400
    if k < 8:
        c.add(k)
    else:
        b += 1
print(max(1,len(c)), b+len(c))

Submission status: Accepted

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

extra = 0
cnt = set()
for a in A:
    r = a // 400
    if r < 8:
        cnt.add(r)
    else:
        extra += 1
print(max(1, len(cnt)), len(cnt) + extra)

Submission status: Accepted

Solution code:
N = int(input())
colors = []
n_wild = 0
for ai in map(int, input().split()):
    bi = ai // 400
    if bi >= 8:
        n_wild += 1
    else:
        colors.append(bi)
n_colors = len(set(colors))
if n_colors == 0:
    print(1, n_wild)
else:
    print(n_colors, n_colors + n_wild)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) // 400 for i in input().split()]
from collections import Counter
rate=Counter(a)
b,cnt = 0, 0
for k,v in rate.items():
    if k < 8:
        cnt += 1
    else:
        b += v
print(max(cnt,1), cnt+b)

Submission status: Accepted

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

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

colors = []
n_minus = 0
for ai in a:
    c = color(ai)
    if c == -1:
        n_minus += 1
    else:
        colors.append(c)
n_colors = len(set(colors))

if n_colors == 0:
    print(1, n_minus)
else:
    print(n_colors, n_colors + n_minus)

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
a = [int(x) // 400 for x in input().split()]

c = Counter(a)

cnt1, cnt2 = 0, 0
for k, v in c.items():
    if k < 8:
        cnt1 += 1
    else:
        cnt2 += v

if cnt1 == 0:
    print(1, cnt2)
else:
    print(cnt1, cnt1 + cnt2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod // i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n - r)
        return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD


# --------------------------------------------

dp = None


def main():
    N = int(input())
    A = li_input()

    C = list(map(lambda x: min(8, x // 400), A))

    if 8 in C:
        free = C.count(8)

        if free == N:
            print(1, free)
        else:
            low = len(set([c for c in C if c != 8]))
            print(low, low + free)
    else:
        ans = len(set(C))
        print(ans, ans)


main()

Submission status: Accepted

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

def getCol(n):
    if n >= 3200:
        return 10
    return (n < 400) + (n < 800) + (n < 1200) + (n < 1600) + (n < 2000) + (n < 2400) + (n < 2800)


cnt = [0] * 100
for a in A:
    col = getCol(a)
    cnt[col] = cnt[col] + 1


num = 0
for i in range(10):
    num = num + (cnt[i] != 0)

mn = max(1, num)
mx = num + cnt[10]
print (mn, mx)

Submission status: Accepted

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

L = [0] * 8
flag = False
for i in range(N):
    if A[i] < 3200:
        flag = True
        num = int(A[i] / 400)
        L[num] = 1
if flag == False:
    S_min = 1
else:
    S_min = sum(L)
count = 0
for i in range(N):
    if A[i] >= 3200:
        count = count + 1
S_max = count + sum(L)
print(S_min, S_max)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
d = dict()
for x in a:
    t = x // 400
    if t > 8:
        t = 8
    d[t] = d.get(t, 0) + 1
ans = 0
for k, v in d.items():
    if k < 8:
        ans += 1
if ans == 0:
    max_v = d.get(8, 0)
    min_v = 1 if max_v > 0 else 0
else:
    max_v = ans + d.get(8, 0)
    min_v = ans
print(min_v, max_v)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
color = [False]*8
almighty = 0
for i in a:
    if i<3200:
        color[i//400] = True
    else:
        almighty += 1
c = color.count(True)
if almighty==0:
    print(c,c)
else:
    print(max(1,c),c+almighty)

Submission status: Accepted

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

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

ans_min = 0
color_min = copy.deepcopy(color)
for c in color_min[:-1]:
    if c > 0:
        ans_min += 1
ans_min = max(1, ans_min)

ans_max = 0
color_max = copy.deepcopy(color)
for c in color_max[:-1]:
    if c > 0:
        ans_max += 1
ans_max += color_max[-1]

print(ans_min, ans_max)

Submission status: Accepted

Solution code:
from collections import OrderedDict

N = int(input())
a = [int(v) for v in input().split()]
color = OrderedDict([
    (399, 0),
    (799, 0),
    (1199, 0),
    (1599, 0),
    (1999, 0),
    (2399, 0),
    (2799, 0),
    (3199, 0)
])
free_num = 0

for v in a:
    if v >= 3200:
        free_num += 1
    else:
        for top in color.keys():
            if v <= top:
                color[top] += 1
                break

ans_min = 0
for v in color.values():
    if v != 0:
        ans_min += 1

ans_max = ans_min + free_num
if ans_min == 0:
    ans_min += 1

print('{0} {1}'.format(ans_min, ans_max))