Problem:


Score : 300 points

Problem Statement

In AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:  

Rating 1-399 : gray

Rating 400-799 : brown

Rating 800-1199 : green

Rating 1200-1599 : cyan

Rating 1600-1999 : blue

Rating 2000-2399 : yellow

Rating 2400-2799 : orange

Rating 2800-3199 : red

Other than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.

Currently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.

Find the minimum and maximum possible numbers of different colors of the users.  

Constraints

1 ≤ N ≤ 100

1 ≤ a_i ≤ 4800

a_i is an integer.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

Print the minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.  

Sample Input 1

4
2100 2500 2700 2700

Sample Output 1

2 2

The user with rating 2100 is "yellow", and the others are "orange". There are two different colors.  

Sample Input 2

5
1100 1900 2800 3200 3200

Sample Output 2

3 5

The user with rating 1100 is "green", the user with rating 1900 is blue and the user with rating 2800 is "red".

If the fourth user picks "red", and the fifth user picks "blue", there are three different colors. This is one possible scenario for the minimum number of colors.

If the fourth user picks "purple", and the fifth user picks "black", there are five different colors. This is one possible scenario for the maximum number of colors.  

Sample Input 3

20
800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990

Sample Output 3

1 1

All the users are "green", and thus there is one color.



Sample input:
4
2100 2500 2700 2700


Sample output:
2 2

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
color = [0 for _ in range(8)]
e = 0

for a in A:
    k = a // 400
    if k < 8 and color[k] == 0:
        color[k] += 1
    elif k >= 8:
        e += 1

c = color.count(1)
y = e + c

if c == 0:
    x = 1
else:
    x = c

print(x, y)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

ans_min = max(1,tmp)
ans_max = tmp + check[-1]

ans = str(ans_min) + ' ' + str(ans_max)
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
from collections import Counter
INF = float("inf")


def solve(N: int, a: "List[int]"):
    c = Counter()
    for aa in a:
        c[min(aa//400, 8)] += 1

    tot = 0
    for k in c:
        if k == 8:
            continue
        else:
            tot += 1
    if tot == 0 and c[8] > 0:
        print(1, c[8])
    else:
        print(tot, tot+c[8])

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict

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

colorCount = defaultdict(int)

for a in A:
    if a < 400:
        colorCount['a'] += 1
    elif a < 800:
        colorCount['b'] += 1
    elif a < 1200:
        colorCount['c'] += 1
    elif a < 1600:
        colorCount['d'] += 1
    elif a < 2000:
        colorCount['e'] += 1
    elif a < 2400:
        colorCount['f'] += 1
    elif a < 2800:
        colorCount['g'] += 1
    elif a < 3200:
        colorCount['h'] += 1
    else:
        colorCount['z'] += 1

minAns = len(colorCount)
maxAns = minAns
if colorCount['z'] > 0:
    if minAns == 1:
        minAns = 1
        maxAns = colorCount['z']
    else:
        minAns -= 1
        maxAns = maxAns - 1 + colorCount['z']

print(minAns, maxAns)

Submission status: Accepted

Solution code:
N=input()
a=list(map(int,input().split()))
j=range(400,3600,400)
c=[0]*8
r=0
for i in a:
    for k in range(8):
        if i>=3200:
            r+=1
            break
        if i<j[k]:
            c[k]+=1
            break
ans=8-c.count(0)
print(max(ans,1),ans+r)

Submission status: Accepted

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

rates = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
l = [0] * 8
tmp = 0
for i in range(N):
    for j in range(8):
        if a[i] < rates[j]:
            l[j] = 1
            break
    else:
        tmp += 1

print(max(sum(l), 1), sum(l)+tmp)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

color = [0] * 8
over = 0
for i in range(N) :
    if a[i] >= 3200 :
        over += 1
    else :
        color[a[i]//400] += 1

m = 8 - color.count(0)
print(max(1, m), m + over)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
color = [0,0,0,0,0,0,0,0,0]
for i in range(n):
    for j in range(1,9):
        if a[i]<400*j and 400*(j-1) <= a[i] and color[j-1] == 0:
            color[j-1] += 1
    if a[i] >= 3200:
        color[8] += 1
print(max(1,sum(color[0:8])),sum(color))

Submission status: Accepted

Solution code:


def f(v):
    idx = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 9999]
    for i, maxval in enumerate(idx):
        if v <= maxval: return i


def solve():
    N = int(input())
    colors = [0] * 9

    for i in [int(v) for v in input().split()]:
        colors[f(i)] += 1

    _cnt = len([c for c in colors[:-1] if c > 0])

    max_cnt = _cnt + colors[-1]
    min_cnt = 1 if _cnt == 0 else _cnt
    print(min_cnt, max_cnt)

solve()

Submission status: Accepted

Solution code:
#3200超えが普通のレートに無い色を使えることが頭に無かった
n = int(input())
rt = list(map(int,input().split()))
clr = [0 for _ in range(9)]
for i in range(n):
  now = rt[i] // 400
  try:
    clr[now] += 1
  except:
    clr[8] += 1
ans = 0
top = clr[8]
for j in range(8):
  if clr[j] != 0:
    ans += 1
if top == 0:
  print(ans,ans)
else:
  print(max(ans,1),ans+top)
#print(clr)

Submission status: Accepted

Solution code:
rates  = [399,799,1199,1599,1999,2399,2799,3199]
from collections import defaultdict


def return_index(score):
  for i in rates:
    if score <= i:
      return rates.index(i)
  else:
    return 8

N = int(input())
A = list(map(int,input().split()))
d = defaultdict(int)
for a in A:
  d[return_index(a)] += 1
key_len = len(d.keys())
num_of_9s = d[8]
has_9 = 1 if num_of_9s > 0 else 0
print("{} {}".format(max(1,key_len-has_9),key_len-has_9+num_of_9s ))

Submission status: Accepted

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

l = []
over3200 = 0
for i in a:
    if i >= 3200:
        over3200 += 1
    else:
        l.append(i//400)
if over3200 == n:
    print(1, over3200)
else:
    print(len(set(l)),len(set(l))+over3200)

Submission status: Accepted

Solution code:
# ABC064C - Colorful Leaderboard
from collections import Counter


def main():
    n = int(input())
    C = Counter(map(lambda x: int(x) // 400, input().split()))
    colored = sum(i < 8 for i in C.keys())  # rate: <3200
    free = sum(j for i, j in C.items() if i >= 8)  # ≥3200
    x, y = max(1, colored), colored + free  # min, max
    print(x, y)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
lst = [int(i) for i in input().split()]
rate = [0] * 8
num = 0

for i in range(n):
    k = lst[i] // 400
    if k < 8 and rate[k] == 0:
        rate[k] += 1
    elif k >= 8:
        num += 1


c = rate.count(1)
y = num+c
if c == 0:
    x = 1
else:
    x = c

print(x,y)

Submission status: Accepted

Solution code:
# 2019/08/08

from bisect import bisect_left

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

pre=0
cnt=0
for i in range(1,9):
    idx=bisect_left(a,i*400)
    if idx==pre or idx==0:continue
    cnt+=1
    pre=idx

    
if idx<n:
    if cnt==0:
        cnt+=1
        res=n-idx
    else:
        res=n-idx+cnt

else:res=cnt
print(cnt,res,sep=' ')

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
score = [[1,399,0],[400,799,0],[800,1199,0],[1200,1599,0],[1600,1999,0],[2000,2399,0],[2400,2799,0],[2800,3199,0],[3200,4800,0]]

for i in range(N):
    for j in range(len(score)):
        if score[j][0] <= a[i] <= score[j][1]:
            score[j][2] += 1
            break
        else:
            continue
ans = 0
for _,_,cnt in score[:-1]:
    if cnt >= 1:
        ans += 1
print(max(1, ans, ans-score[-1][2]), ans+score[-1][2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
b,c=[],0
b.append(len([a for a in a if a<400]))
b.append(len([a for a in a if a<800 and a>=400]))
b.append(len([a for a in a if a<1200 and a>=800]))
b.append(len([a for a in a if a<1600 and a>=1200]))
b.append(len([a for a in a if a<2000 and a>=1600]))
b.append(len([a for a in a if a<2400 and a>=2000]))
b.append(len([a for a in a if a<2800 and a>=2400]))
b.append(len([a for a in a if a<3200 and a>=2800]))
b.append(len([a for a in a if a>=3200]))
for i in range(8):
    if b[i]>0:
        c+=1
if b[8]>0:
    if c==0:
        print(1,b[8])
    else:        
        print(c,c+b[8])
else:
    print(c,c)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
an = list(map(int,input().split()))
rate_bucket = [0] * 9
ret = 0
for a in an:
    rate_bucket[min(a//400,8)]+=1
for i in rate_bucket[0:-1:]:
    if i > 0:
        ret+=1
print("{} {}".format(max(ret,1),ret+rate_bucket[-1]))

Submission status: Accepted

Solution code:
from bisect import bisect as bisect

def main():
    score = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
    M = len(score)
    N = int(input())
    A = [int(x) for x in input().split()]

    colors = set()
    m = 0
    for a in A:
        i = bisect(score, a)
        if i != M:
            colors.add(i)
        elif i == M:
            m += 1
    print(len(colors) if len(colors) > 0 else 1, len(colors)+m)

main()

Submission status: Accepted

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

colorlist = [0] * 8
freecolor = 0
colormin = 0
for i in a:
    if i >= 3200:
        freecolor += 1
    else:
        colorlist[i // 400] += 1


# print(colorlist)

for i in colorlist:
    if i != 0:
        colormin += 1

# 最小値
if colormin == 0:
    print(1, end=' ')
else:
    print(colormin, end=' ')

# 最大値
s = colormin + freecolor
if s > n:
    s = n
print(s)

Submission status: Accepted

Solution code:
li_a = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 1000000]
li_b = ["a", "b", "c", "d", "e", "f", "g", "h", 1]

n = int(input())
people = list(map(int,input().split()))
ans = []
cnt = 0

s = 0
t = 0

for i in range(n):
    for j in range(9):
        if people[i] >= 3200:
            cnt += 1
            break
        elif people[i] <= li_a[j]:
            ans.append(li_b[j])
            break

ans = list(set(ans))
if cnt > 0:
    t = cnt
if len(ans) == 0:
    s = 1
print(len(ans)+s,len(ans)+t)

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int, input().split()))
co_li = [0]*8
any_col = 0
for s in li:
    if s < 400:
        co_li[0] += 1
    elif 400 <= s < 800:
        co_li[1] += 1
    elif 800 <= s < 1200:
        co_li[2] += 1
    elif 1200 <= s < 1600:
        co_li[3] += 1
    elif 1600 <= s < 2000:
        co_li[4] += 1
    elif 2000 <= s < 2400:
        co_li[5] += 1
    elif 2400 <= s < 2800:
        co_li[6] += 1
    elif 2800 <= s < 3200:
        co_li[7] += 1
    elif 3200 <= s:
        any_col += 1
color_kind = sum(x>0 for x in co_li)
is_all_any_color = sum(co_li) == 0
min_sum = color_kind + (1 if is_all_any_color is True else 0)
max_sum = color_kind + any_col
print(min_sum,max_sum)

Submission status: Accepted

Solution code:
N = int(input())
rates = list(map(int, input().split()))
over = 0
colors = []
GREY = 0
BROWN = 1
GREEN = 2
SKY = 3
BLUE = 4
YELLOW = 5
ORANGE = 6
RED = 7

for rate in rates:
  if rate <= 399:
    if not GREY in colors:
      colors.append(GREY)
  elif rate <= 799:
    if not BROWN in colors:
      colors.append(BROWN)
  elif rate <= 1199:
    if not GREEN in colors:
      colors.append(GREEN)
  elif rate <= 1599:
    if not SKY in colors:
      colors.append(SKY)
  elif rate <= 1999:
    if not BLUE in colors:
      colors.append(BLUE)
  elif rate <= 2399:
    if not YELLOW in colors:
      colors.append(YELLOW)
  elif rate <= 2799:
    if not ORANGE in colors:
      colors.append(ORANGE)
  elif rate <= 3199:
    if not RED in colors:
      colors.append(RED)
  else:
    over += 1
min_c = max(1, len(colors))
max_c = len(colors)+over
print(min_c, max_c)

Submission status: Accepted

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


def solve(N: int, a: "List[int]"):
    ans = [0] * 8
    a32 = 0
    for i in a:
        if(i >= 3200):
            a32 += 1
        else:
            if(i < 400):
                ans[0] +=1
            elif(400 <= i < 800):
                ans[1] +=1
            elif(800 <= i < 1200):
                ans[2] +=1
            elif(1200 <= i < 1600):
                ans[3] +=1
            elif(1600 <= i < 2000):
                ans[4] +=1
            elif(2000 <= i < 2400):
                ans[5] +=1
            elif(2400 <= i < 2800):
                ans[6] +=1
            elif(2800 <= i < 3200):
                ans[7] +=1

    if(ans.count(0) == 8):
        if(a32 > 0):
            print(1, a32)
        else:
            print(0, 0)
    else:
        print(8-ans.count(0), 8-ans.count(0)+a32)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    A = inputList()
    
    free = 0
    a = [0 for _ in range(8)]
    
    for i in A:
        if i < 400:
            a[0] += 1
        elif i < 800:
            a[1] += 1
        elif i < 1200:
            a[2] += 1
        elif i < 1600:
            a[3] += 1
        elif i < 2000:
            a[4] += 1
        elif i < 2400:
            a[5] += 1
        elif i < 2800:
            a[6] += 1
        elif i < 3200:
            a[7] += 1
        else:
            free += 1
            
    ans = 0
    for i in a:
        if i == 0:
            continue
        if i != 0:
            ans += 1
            
    if ans != 0:
        print("{} {}".format(ans, ans+free))
    else:
        print("{} {}".format(1, ans+free))
    
        
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
A = [int(_) // 400 if int(_) <= 3199 else 8 for _ in input().split()]

min_counter = Counter(A).copy()
if 8 in min_counter.keys():
    min_counter.pop(8)
    if not min_counter:
        minimum = 1
    else:
        minimum = len(min_counter)
else:
    minimum = len(min_counter)

maximum = 0
max_counter = Counter(A).copy()

if 8 in max_counter.keys():
    maximum = max_counter[8]
    max_counter.pop(8)
    maximum += len(max_counter)
else:
    maximum += len(max_counter)

print(minimum, maximum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = [int(zz) for zz in input().split()]

ans = set()
p = 0
for i in S:
    q = i // 400
    if q < 8:
        ans.add(q)
    else:
        p += 1

if N == 1:
    print(1, 1)
else:
    print(max(1,len(ans)), len(ans) + p)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
n=int(input())
a_list=list(map(int,input().split()))
rate=[False]*8
free=0
for i in a_list:
    if i<3200:
        rate[i//400]=True
    else:
        free+=1
count=0
for i in rate:
    if i:
        count+=1
if count==0:
    Min=1
else:
    Min=count
Max=count+free
print(Min,Max)

Submission status: Accepted

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

Submission status: Accepted

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

rate = [0 for _ in range(8)]
free = 0
for a in A:
    r = a // 400
    if r >= 8:
        free += 1
    else:
        rate[r] += 1

a1 = 0
for r in rate:
    if r != 0:
        a1 += 1
a2 = free + a1
if a1 == 0:
    a1 = 1
print(a1, a2)

Submission status: Accepted

Solution code:
from collections import Counter
 
n = int(input())
a = [int(i) for i in input().split()]
c = Counter()
b = 0
for i in a:
    if i < 3200:
        c.update([i//400])
    else: b += 1
print(len(c) if len(c) else 1, len(c) + b)

Submission status: Accepted

Solution code:
import sys

n = int(sys.stdin.readline())
a_list = [int(x) for x in sys.stdin.readline().split()]

color_list = [0] * 8
rainbow = 0
for i in a_list:
    if int(i / 400) < 8:
        color_list[int(i / 400)] += 1
    else:
        rainbow += 1
color_list = [i for i in color_list if i != 0]
confirm = len(color_list)
if confirm == 0:
    print(1, min(8, rainbow))
else:
    print(confirm, confirm + rainbow)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
color = {"grey":False, "brown":False, "green":False, "light_blue":False, "blue":False, "yellow":False, "orange":False, "red":False}
free = 0
def rate(n):
    global free
    if 1 <= n <= 399:
        color["grey"] = True
    elif 400 <= n <= 799:
        color["brown"] = True
    elif 800 <= n <= 1199:
        color["green"] = True
    elif 1200 <= n <= 1599:
        color["light_blue"] = True
    elif 1600 <= n <= 1999:
        color["blue"] = True
    elif 2000 <= n <= 2399:
        color["yellow"] = True
    elif 2400 <= n <= 2799:
        color["orange"] = True
    elif 2800 <= n <= 3199:
        color["red"] = True
    else:
        free += 1
for i in range(n):
    rate(a[i])
print(max(list(color.values()).count(True), 1), list(color.values()).count(True) + free)

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
ch_cnt = 0
b = []
for i in range(n):
    if a[i] >= 3200:
        ch_cnt += 1
        b.append('special')
    elif a[i] < 3200 and a[i] >= 2800:
        b.append('red')
    elif a[i] < 2800 and a[i] >= 2400:
        b.append('orange')
    elif a[i] < 2400 and a[i] >= 2000:
        b.append('yellow')
    elif a[i] < 2000 and a[i] >= 1600:
        b.append('blue')
    elif a[i] < 1600 and a[i] >= 1200:
        b.append('cyan')
    elif a[i] < 1200 and a[i] >= 800:
        b.append('green')
    elif a[i] < 800 and a[i] > 400:
        b.append('brown')
    else:
        b.append('gray')
b_cnt = Counter(b)
spe_cnt = 0
if b_cnt['special']:
    spe_cnt += b_cnt['special']
    if len(b_cnt) == 1:
        print(1, min(8, spe_cnt))
    else:
        print(len(b_cnt)-1, len(b_cnt)-1+spe_cnt)
else:
    print(len(b_cnt), len(b_cnt))

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
count = 0
colors = [False]*8
for a in A:
    q, r = divmod(a, 400)
    if q < 8:
        colors[q] = True
    else:
        count += 1
ans = sum(colors)
if ans > 0:
    print(ans, ans + count)
else:
    print(1, ans + count)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
C=[]
r=0
cnt=0
for a in A:
    aa=min(a//400,8)
    if aa in C:pass
    else:
        C.append(aa)
        cnt+=1
    if aa==8:r+=1
if r==0:print(cnt,cnt)
else:print(max(1,cnt-1),cnt+r-1)

Submission status: Accepted

Solution code:
n=int(input())
L=list(map(int,input().split()))
L.sort()
tmp=0
cnt=0
min_c=0
max_c=0

for i in range(n):
	if L[i] <= 399:
		cnt+=1
		tmp=i
		break

for i in range(tmp,n):
	if L[i] >= 400 and L[i] <= 799:
		cnt+=1
		tmp=i
		break

for i in range(tmp,n):
	if L[i] >= 800 and L[i] <= 1199:
		cnt+=1
		tmp=i
		break
		
for i in range(tmp,n):
	if L[i] >= 1200 and L[i] <= 1599:
		cnt+=1
		tmp=i
		break
		
for i in range(tmp,n):
	if L[i] >= 1600 and L[i] <= 1999:
		cnt+=1
		tmp=i
		break

for i in range(tmp,n):
	if L[i] >= 2000 and L[i] <= 2399:
		cnt+=1
		tmp=i
		break
		
for i in range(tmp,n):
	if L[i] >= 2400 and L[i] <= 2799:
		cnt+=1
		tmp=i
		break

for i in range(tmp,n):
	if L[i] >= 2800 and L[i] <= 3199:
		cnt+=1
		tmp=i
		break
		
min_c=cnt
max_c=cnt

for i in range(tmp,n):
	if L[i] >= 3200:
		max_c=cnt+len(L[i:])
		if min_c==0:
			min_c+=1
		break
		
print(min_c,max_c)

Submission status: Accepted

Solution code:
from copy import *
from sys import *
import math
import queue
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


def main():
	n = int(input())
	a = list(map(int,input().split()))
	color = [0 for i in range(8)]
	free = 0
	for i in a:
		if(i//400>7):
			free+=1
		else:
			color[i//400] = 1
	print(str(max(1,sum(color)))+' '+str(min(10**100,sum(color)+free)))


def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

Submission status: Accepted

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

colors = set()
free_num = 0
for rate in a:
    if rate < 400:
        colors.add("grey")
    elif rate < 800:
        colors.add("brown")
    elif rate < 1200:
        colors.add("green")
    elif rate < 1600:
        colors.add("sky")
    elif rate < 2000:
        colors.add("blue")
    elif rate < 2400:
        colors.add("yellow")
    elif rate < 2800:
        colors.add("orange")
    elif rate < 3200:
        colors.add("red")
    else:
        free_num += 1
if len(colors) > 0:        
    print(len(colors), free_num + len(colors))
else:
    print(1, free_num)

Submission status: Accepted

Solution code:
input()
an = [int(i) for i in input().split()]
score = [0]*13
ans = 0

for i in an:
  score[i//400] += 1   
for i in score[:8]:
  if i:
    ans += 1

k = sum(score[8:])

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

Submission status: Accepted

Solution code:
import collections
N = int(input())
a = [min(int(i)//400,8) for i in input().split()]
b = collections.Counter(a)
tmp = 0
for i in range(8):
  if b[i] >= 1:
    tmp += 1
if tmp >= 1:
  amin = tmp
  amax = tmp+b[8]
else:
  amin = 1
  amax = tmp+b[8]
print(amin,amax)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    _, b, c = LS()
    x = int(b[0] + c[0]) % 4
    if not x:
        print("YES")
    else:
        print("NO")
    return

#B
def B():
    II()
    a = LI()
    a.sort()
    print(a[-1]-a[0])
    return

#C
def C():
    II()
    a = LI()
    a = list(map(lambda x: x // 400, a))
    d = defaultdict(int)
    for ai in a:
        d[ai] += 1
    ans1 = 0
    ans2 = 0
    for key, value in d.items():
        if key <= 7:
            ans1 += 1
            ans2 += 1
        else:
            ans2 += value
    if ans1 == 0:
        ans1 = 1
    print(ans1, ans2)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()

Submission status: Accepted

Solution code:
a = int(input())
b = list(map(int, input().split()))
c = {}
for i in b:
    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:
        if 8 not in c:
            c[8] = 1
        else:
            c[8] += 1
count = 0
se = 0
for k, v in c.items():
    if k == 8:
        se = v
    else:
        count += 1
if se == 0:
    print("{} {}".format(count, count))
else:
    if count == 0:
        print("{} {}".format(1, se))
    else:
        print("{} {}".format(count, count + se))

Submission status: Accepted

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

    color = [False] * 8

    cnt = 0
    for i in a:
        if 1 <= i <= 399:
            color[0] = True
        elif 400 <= i <= 799:
            color[1] = True
        elif 800 <= i <= 1199:
            color[2] = True
        elif 1200 <= i <= 1599:
            color[3] = True
        elif 1600 <= i <= 1999:
            color[4] = True
        elif 2000 <= i <= 2399:
            color[5] = True
        elif 2400 <= i <= 2799:
            color[6] = True
        elif 2800 <= i <= 3199:
            color[7] = True
        elif 3200 <= i:
            cnt += 1
    if color.count(True) == 0:
        print(1, color.count(True) + cnt)
    else:
        print(color.count(True), color.count(True) + cnt)
    

main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
#ABC064C
import math

n = int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

area=[0,0,0,0,0,0,0,0,0]
#print(area)

for i in range(0,n):
	fuga = (hoge[i]//400)
	if(fuga>8):fuga=8
	area[fuga]+=1

#print("---")
#print(hoge)
#print(area)

ans=0
for i in range(0,8):
	if(area[i]>0):
		ans += 1
#print(ans)
if(ans==0):
	min=1
else:
	min=ans
max=ans+area[8]

print("{} {}".format(min,max))

Submission status: Accepted

Solution code:
a = int(input())
b = list(map(int, input().split()))
c = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0}
d = 0
for i in b:
    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:
        d += 1
e = 0
for k, v in c.items():
    if v != 0:
        e += 1
print(str(max(e, 1)) + " " + str(e + d))