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 bisect

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

A.sort()

rank = [0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 3200, 3200, 3200, 3200, 3200]
n_rank = []
for i in range(1,len(rank)):
  var = bisect.bisect_left(A, rank[i]) - bisect.bisect_left(A, rank[i-1])
  n_rank.append(var)
else:
  n_rank.append(len(A) - bisect.bisect_left(A, rank[-1]))
  
n_color = sum(n_rank[i] != 0 for i in range(len(n_rank)-1))

min_color = max(n_color, 1)
max_color = n_color + n_rank[-1]

print(str(min_color) +' '+ str(max_color))

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
rate=[400,800,1200,1600,2000,2400,2800,3200]
a.sort()
answer=0
counter=0
i=0
j=0
while i<N:
    if a[i]>=rate[j]:
        j+=1
    else:
        answer+=1
        while i<N and a[i]<rate[j]:
            i+=1
        j+=1
    if i<N and j==8:
        counter+=N-i
        break
print(max(answer,1),answer+counter)

Submission status: Accepted

Solution code:
def smaller(x, y):
	if x < y: return x
	return y
N = int(input())
A = list(map(int, input().split()))
colorlist = [[1, 399]]
for i in range(1, 8):
	colorlist.append([400*i, 400*(i+1)-1])
ratelist = [False, False, False, False, False, False, False, False]
overcount = 0
for i in range(0, N):
	for j in range(0, 8):
		if colorlist[j][0] <= A[i] and A[i] <= colorlist[j][1]:
			ratelist[j] = True
			break
		if j == 7: overcount += 1
min = 0
for i in range(0, 8):
	if ratelist[i]: min += 1
if min == 0:
	min = 1
	overcount -= 1
max = min + overcount
print(str(min)+' '+str(max))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
D = {
    'gray': 0,
    'brown': 0,
    'green': 0,
    'lightblue': 0,
    'blue': 0,
    'yellow': 0,
    'orange': 0,
    'red': 0,
}
ultimate = 0

for a in A:
    if a < 400:
        D['gray'] += 1
    elif a < 800:
        D['brown'] += 1
    elif a < 1200:
        D['green'] += 1
    elif a < 1600:
        D['lightblue'] += 1
    elif a < 2000:
        D['blue'] += 1
    elif a < 2400:
        D['yellow'] += 1
    elif a < 2800:
        D['orange'] += 1
    elif a < 3200:
        D['red'] += 1
    else:
        ultimate += 1

smallest = sum(map(bool, D.values()))
biggest = smallest + ultimate
print(max(1, smallest), biggest)

Submission status: Accepted

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

n = int(input())
a = list(map(int, input().split()))
cnt = 0
rate_cnt = [0]*8
for i in range(n):
    if a[i] >= 3200:
        cnt += 1
    elif a[i] >= 2800:
        rate_cnt[7] += 1
    elif a[i] >= 2400:
        rate_cnt[6] += 1
    elif a[i] >= 2000:
        rate_cnt[5] += 1
    elif a[i] >= 1600:
        rate_cnt[4] += 1
    elif a[i] >= 1200:
        rate_cnt[3] += 1
    elif a[i] >= 800:
        rate_cnt[2] += 1
    elif a[i] >= 400:
        rate_cnt[1] += 1
    else:
        rate_cnt[0] += 1
for j in range(8):
    if 0 in rate_cnt:
        rate_cnt.remove(0)
    else:
        break
max_ans = len(rate_cnt)+cnt
if len(rate_cnt) == 0:
    min_ans = 1
else:
    min_ans = len(rate_cnt)
print(min_ans, max_ans)

Submission status: Accepted

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

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

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  l2=[]
  c=0
  for x in l:
    if x>=3200:
      c+=1
      l2.append(8)
    else:
      l2.append(x//400)

  l2=list(set(l2))

  if len(l2)!=1 and l2.count(8):
    l2.remove(8)

  if len(l2)==1 and l2[0]==8:
    c=max(0,c-1)

  print(len(l2),len(l2)+c)

main()

Submission status: Accepted

Solution code:
import math

l = input().split()
N = int(l[0])

l = input().split()
A = [0] * 13
for a in l:
    index = int(a) // 400
    if index < 8:
        A[index] = 1
    else:
        A[index] += 1

# print(N, A)

num_colored = sum(A[:8])
num_free = sum(A[8:])

print(max(1, num_colored), num_colored + num_free)

Submission status: Accepted

Solution code:
import math
N = int(input())
A = list(map(int, input().split()))
a_lst = [0 for i in range(9)]

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

mn = len([0 for i in a_lst[:-1] if i > 0])
mx = mn + a_lst[-1]
if mn == 0:
    mn = 1
print(mn, mx)

Submission status: Accepted

Solution code:
n = int(input())
ai = list(map(int,input().split()))
aj = list(map(lambda x:int(x/400),ai))
rainbow = 0
for e in aj:
  if e >= 8:
    rainbow += 1
ak= set(aj)
ans = 0
for e in ak:
  if e < 8:
    ans += 1
print(max(1,ans) ,end='')
print(' ' ,end = '')
print(ans+ rainbow)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = [0] * 9

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

subMin = sum(cnt[:-1])
Min = max(subMin, 1)
Max = subMin + cnt[-1]

print(Min, Max)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
l = [0] * 13

for i in a:
  l[int(i/400)] += 1

color = 0
anycolor = 0
for i in range(8):
  if l[i] != 0:
    color += 1
for i in range(8, 13):
  anycolor += l[i]

ret1 = max(color, 1)
ret2 = color+anycolor

print(str(ret1) + " " + str(ret2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    a = [0] + [int(ele) for ele in input().split()]
    a.sort()
    ans_min = 0
    ans_min += 1 if len(list(filter(lambda x: 1 <= x <= 399, a ))) > 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 400 <= x <= 799, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 800 <= x <= 1200, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 1200 <= x <= 1599, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 1600 <= x <= 1999, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 2000 <= x <= 2399, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 2400 <= x <= 2799, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 2800 <= x <= 3199, a )))> 0 else 0
    over = list(filter(lambda x: 3200 <= x, a ))

    ans_max = ans_min + len(over)

    if ans_min == 0 and len(over) > 0:
        ans_min = 1 

    print(ans_min, ans_max)


if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
dat_a = list(map(int, input().split()))
dat = set()
all_color = 0

for i in range(n):
    if dat_a[i] < 400:
        dat.add("a")
    elif dat_a[i] < 800:
        dat.add("b")
    elif dat_a[i] < 1200:
        dat.add("c")
    elif dat_a[i] < 1600:
        dat.add("d")
    elif dat_a[i] < 2000:
        dat.add("e")
    elif dat_a[i] < 2400:
        dat.add("f")
    elif dat_a[i] < 2800:
        dat.add("g")
    elif dat_a[i] < 3200:
        dat.add("h")
    else:
        all_color += 1

colored = len(dat)

resmin = colored
if resmin == 0 and all_color > 0:
    resmin = 1

resmax = colored + all_color
#if resmax > 8:
#    resmax = 8

print("{0} {1}".format(str(resmin), str(resmax)))

Submission status: Accepted

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

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

number = []
over = 0
for i in range(8):
    number.append(False)

for i in a:
    position = int((i / 100) // 4)
    if position < 8:
        number[position] = True
    else:
        over += 1

minimum = number.count(True)
if minimum == 0:
    minimum = 1
maximum = number.count(True) + over
#if maximum > 8:
#    maximum = 8

print(str(minimum) + ' ' + str(maximum))

Submission status: Accepted

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

a.sort()
min_color = [0] * 8
max_color = [0] * 8
extra = 0

for i in a:
    if i >= 3200:
        if sum(min_color) == 0:
            min_color[0] = 1
        extra += 1
    else:
        min_color[i // 400] = 1
        max_color[i // 400] = 1


print( sum(min_color), sum(max_color) + extra)

Submission status: Accepted

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

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

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

ans = 0
for i in range(len(colors)-1):
  if colors[i] !=0 :
    ans +=1

if ans == 0:
  print(str(1) + " " + str(colors[8] + ans))
else:
  print(str(ans) + " " + str(colors[8] + ans))

Submission status: Accepted

Solution code:
gray = []
brown = []
green = []
w_blue = []
blue = []
yellow = []
orange = []
red = []
seq = []
N = int(input())
a = list(map(int,input().split()))
for i in a:
    if 1 <= i < 400:
        gray.append(i)
    elif 400 <= i < 800:
        brown.append(i)
    elif 800 <= i < 1200:
        green.append(i)
    elif 1200 <= i < 1600:
        w_blue.append(i)
    elif 1600 <= i < 2000:
        blue.append(i)
    elif 2000 <= i < 2400:
        yellow.append(i)
    elif 2400 <= i < 2800:
        orange.append(i)
    elif 2800 <= i < 3200:
        red.append(i)
    else:
        seq.append(i)

L = [gray,brown,green,w_blue,blue,yellow,orange,red]
ans = 0
for i in L:
    if len(i) >= 1:
        ans += 1
if ans != 0:
    print(ans,ans+len(seq))
else:
    print(1,len(seq))

Submission status: Accepted

Solution code:
N = int(input())
*a, = map(int, input().split())
var = 0
cnt = [0] * 8

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

print(max(cnt.count(1), 1), cnt.count(1) + var)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
ans=0
for i in range(n):
    if a[i]//400<8:
        b.append(a[i]//400)
    else:
        ans+=1
x=max(1,len(set(b)))
y=ans+len(set(b))
#if y>=8:
#    y=8
#else:
#    y=y


print(x,y)

Submission status: Accepted

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

def col(x):
  if x < 400:
    return 0
  if x < 800:
    return 1
  if x < 1200:
    return 2
  if x < 1600:
    return 3
  if x < 2000:
    return 4
  # 等差かよ
  if x < 2400:
    return 5
  if x < 2800:
    return 6
  if x < 3200:
    return 7
  return 8

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

basic = sum([min(x,1) for x in cnt[:8]])
rainbow = cnt[8]

MIN = max(1,basic)
#MAX = min(basic+rainbow,8)
MAX = basic+rainbow
print(MIN,MAX)

Submission status: Accepted

Solution code:
n = int(input())
rate_list = [ int(v) for v in input().split() ]
color_list = [0 for i in range(8)]
free = 0
for i in rate_list:
	if  i < 3200:
		color_list[i//400] += 1
	else:
		free += 1


min_color = 8 - color_list.count(0)
max_color = free + min_color
if min_color == 0:
	min_color = 1
print(min_color,max_color)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, *a = map(int, open(0).read().split())
ans = set()
over = 0
for v in a:
    v //= 400
    if v < 8:
        ans.add(v)
    else:
        over += 1
print(max(len(ans), 1), len(ans) + over)

Submission status: Accepted

Solution code:
n = int(input())
a = map(int, input().split())
colors = {}
for i in a:
    if i//400 <= 7:
        colors[i//400] = 1
    else:
        if 8 in colors:
            colors[8] += 1
        else:
            colors[8] = 1
if 8 in colors:
    if len(colors) == 1:
        print(1, sum(colors.values()))
    else:
        print(len(colors)-1, sum(colors.values()))
else:
    print(len(colors), len(colors))

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
colors = 0
for i in range(8):
    colors += any(i * 400 <= a < (i + 1) * 400 for a in A)
print(max(colors, 1), end=' ')
colors += sum((i + 1) * 400 <= a for a in A)
print(colors)

Submission status: Accepted

Solution code:
import itertools
import math
N = int(input())
nums = list(map(int,input().split(" ")))
nums.sort()
ind = 0
maxcolor = 0
mincolor = 0
cols = []
while True:
    if ind == N or nums[ind] >= 3200:
        break
    cols.append(nums[ind]//400)
    ind += 1

cols = list(set(cols))
over3200 = nums[ind:]
maxcolor = mincolor = len(cols) #3200未満の色の種類

if len(over3200) > 0:
    if mincolor > 0: #3200以下が一人でもいたらそれに合わせて終わり
        pass
    else:
        mincolor = 1 #3200以下が居なかったら全員同じ色に

maxcolor = maxcolor + len(over3200)
print(mincolor,maxcolor)

Submission status: Accepted

Solution code:
N = int(input())
a = [int(x) for x in input().split()]
colors = [0]*9
cnt = 0
for i in a:
    if(i//400>8):
        colors[8]+=1
    else:
        colors[i//400]+=1
for i in colors[:-1]:
    if(i>0):
        cnt+=1
if(cnt == 0 and colors[8]>0):
    print(1,colors[8])
else:
    print(cnt,cnt+colors[8])

Submission status: Accepted

Solution code:
N = int(input())
colors = [False]*8
high_rate_count = 0
for num in input().split():
    rate = int(int(num)/400)
    if rate > 7:
        high_rate_count += 1
    else:
        colors[rate] = True
count = 0
for color in colors:
    if color:
        count += 1
if count == 0:
    count = 1
    high_rate_count -= 1
max_count = count + high_rate_count
print(count, max_count)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
color=[0]*9
for i in a:
    if i//400<=7:
        color[i//400]+=1
    else:
        color[8]+=1
m=8-color[:8].count(0)
M=m+color[8]
if m==0:
    m=1
print(m,M)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc064/tasks/abc064_c

import itertools
from collections import Counter
from collections import defaultdict
import bisect
import math
import heapq

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

    ratings = [0] * 9
    for a in A:
        ratings[min(a // 400, 8)] += 1

    # print(ratings)

    fixed_colors = 0
    for r in range(len(ratings) - 1):
        if ratings[r] > 0:
            fixed_colors += 1

    everything_ok = ratings[-1]

    min_colors = fixed_colors if fixed_colors > 0 else 1
    max_colors = fixed_colors + everything_ok
    print('{} {}'.format(min_colors, max_colors))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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


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

    """方針
    色が8のとき、何色にもなれる。

    先に0~7の色を埋める(Trueにして)。これが最小の数。
    
    その後、最小の数に、色が8の数を足す。それが最大の数。

    問題文に書かれている色以外にもなれることに注意。黒色とか。
    """
    min_colors = [False] * 8
    color8_cnt = 0
    for i, a in enumerate(A):
        color = determine_color(a)
        if color == 8:
            color8_cnt += 1
            continue
        min_colors[color] = True
    
    min_ans = 0
    for i, c in enumerate(min_colors):
        if c:
            min_ans += 1
    
    max_ans = min_ans
    max_ans += color8_cnt

    if min_ans == 0 and color8_cnt != 0:
        min_ans = 1

    print("{} {}".format(min_ans, max_ans))



if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
free = 0
color = set()
for i in a:
    if i >= 3200:
        free += 1
    else:
        color.add(i//400)
print(max(1, len(color)), len(color) + free)

Submission status: Accepted

Solution code:
#   1 - 399：灰色
#  400- 799：茶色
#  800-1199：緑色
# 1200-1599：水色
# 1600-1999：青色
# 2000-2399：黄色
# 2400-2799：橙色
# 2800-3199：赤色
# また、レートが 3200 以上になると色を自由に変えることができます。

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

used_colors = set()
unknown_color = 0

for i in range(n):
    if   1  <= a[i] <=  399: used_colors.add(0)
    if  400 <= a[i] <=  799: used_colors.add(1)
    if  800 <= a[i] <= 1199: used_colors.add(2)
    if 1200 <= a[i] <= 1599: used_colors.add(3)
    if 1600 <= a[i] <= 1999: used_colors.add(4)
    if 2000 <= a[i] <= 2399: used_colors.add(5)
    if 2400 <= a[i] <= 2799: used_colors.add(6)
    if 2800 <= a[i] <= 3199: used_colors.add(7)
    if 3200 <= a[i]        : unknown_color += 1

minimum = max(1, len(used_colors))
maximum = len(used_colors) + unknown_color
print(minimum, maximum)

Submission status: Accepted

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

count = [0,0,0,0,0,0,0,0,0]

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

print(max(1,sum(count[:-1])),sum(count))

Submission status: Accepted

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+400)) 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
ans = vars.count(True)
if ans == 0:
    print(1, ans+len(exc))
else:
    print(ans, ans+len(exc))

Submission status: Accepted

Solution code:
# /usr/bin/python
# -*- coding: utf-8 -*-
import math







def main():
  N = int(input())
  An = list(map(int, input().split()))
  Bn = [0] * 9
  for a in An:
    Bn[min(a//400,8)] += 1
  for i in range(len(Bn)-1):
    Bn[i] = math.ceil(Bn[i]/1000)

  mn = max(1, sum(Bn[:-1]))
  mx = sum(Bn)

  return mn,mx

if __name__ == "__main__":
  ret1,ret2 = main()
  print(ret1,ret2)

Submission status: Accepted

Solution code:
n=int(input())
arr=list(map(int,input().split()))
for i in range(n):
  arr[i]=arr[i]//400
  if arr[i]>=9:
    arr[i]=8
cnt=[arr.count(i) for i in range(9)]
ans=0
for i in range(8):
  if cnt[i]!=0:
    ans+=1
if ans==0:
  print(1,cnt[-1])
else:
  print(ans,ans+cnt[-1])

Submission status: Accepted

Solution code:
N = int(input())
lst_a = list(map(int, input().split()))
lst_color = [0] * 8
cnt_super = 0


for a in lst_a:
    i = a // 400
    if i >= 8:
        cnt_super += 1
    else:
        lst_color[i] += 1
cnt_existed = sum(1 for x in lst_color if x!=0)


ans_min = max(cnt_existed, 1)
ans_max = cnt_existed + cnt_super


print(ans_min, ans_max)

Submission status: Accepted

Solution code:
N = int(input())
lst_a = list(map(int, input().split()))
lst_color = [0] * 8
cnt_super = 0


for a in lst_a:
    if 1 <= a <= 399:
        lst_color[0] += 1
    elif 400 <= a <= 799:
        lst_color[1] += 1
    elif 800 <= a <= 1199:
        lst_color[2] += 1
    elif 1200 <= a <= 1599:
        lst_color[3] += 1
    elif 1600 <= a <= 1999:
        lst_color[4] += 1
    elif 2000 <= a <= 2399:
        lst_color[5] += 1
    elif 2400 <= a <= 2799:
        lst_color[6] += 1
    elif 2800 <= a <= 3199:
        lst_color[7] += 1
    else:
        cnt_super += 1
cnt_existed = sum(1 for x in lst_color if x!=0)


if cnt_existed == 0:
    ans_min = 1
    ans_max = cnt_super
else:
    ans_min = cnt_existed
    ans_max = cnt_existed + cnt_super


print(ans_min, ans_max)

Submission status: Accepted

Solution code:
N = int(input())
A = (int(i) // 400 for i in input().split())

m, d = [0] * 8, 0
for a in A:
    if a >= 8:
        d += 1
    else:
        m[a] = 1
s = sum(m)
if s > 0:
    print(s, s + d)
else:
    print(1, N)

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
A = (int(i) // 400 for i in input().split())

mi, d = 0, 0
for k, v in Counter(A).items():
    if k >= 8:
        d += v
    else:
        mi += 1

if mi == 0:
    print(1, N)
else:
    print(mi, mi + d)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
rate = [400 * i for i in range(9)]
nums = [0] * 8
tourist = 0

for i in range(N):
    for j in range(8):
        if rate[j] <= a[i] < rate[j+1]:
            nums[j] = 1
    if a[i] >= 3200:
        tourist += 1

color = nums.count(1)

print(1 if color == 0 and tourist else color, color + tourist)

Submission status: Accepted

Solution code:
input()
*A, = map(lambda x:int(x)//400,input().split())
high = 0
c = set()
for a in A:
    if a>=8:
        high += 1
    else:
        c.add(a)
n = len(c)
print(max(n,1),n+high)

Submission status: Accepted

Solution code:
N = int(input())
c = [0] * 9
for a in map(int, input().split()):
    c[min(a // 400, 8)] += 1
csum = sum(map(bool, c[:8]))
print(max(csum, 1), csum + c[8])

Submission status: Accepted

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

color = [0] * 9
for i in range(N):
  if a[i] < 400:
    color[0] += 1
  elif a[i] < 800:
    color[1] += 1
  elif a[i] < 1200:
    color[2] += 1
  elif a[i] < 1600:
    color[3] += 1
  elif a[i] < 2000:
    color[4] += 1
  elif a[i] < 2400:
    color[5] += 1
  elif a[i] < 2800:
    color[6] += 1
  elif a[i] < 3200:
    color[7] += 1
  else:
    color[8] += 1
#print(color)
tmp = 0
for i in range(8):
  if color[i] > 0:
    tmp += 1
color_min = max(tmp, 1)
color_max = tmp + color[8]
print("{0} {1}".format(color_min, color_max))

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
a = list(map(lambda x:min(int(x)//400,8),input().split(" ")))
c = Counter(a)
s = 0
for i in [0,1,2,3,4,5,6,7]:
    s += (c[i] and 1)
l = max(1,s)
m = max(1,s+c[8])
print(str(l)+" "+str(m))

Submission status: Accepted

Solution code:
#ABC064C
N = int(input())
ai = list(map(int, input().split()))
colors = [0]*8
kinds = 0
all_col = 0
for a in ai:
    if a < 400:
        colors[0] = 1
    elif a < 800:
        colors[1] = 1
    elif a < 1200:
        colors[2] = 1
    elif a < 1600:
        colors[3] = 1
    elif a < 2000:
        colors[4] = 1
    elif a < 2400:
        colors[5] = 1
    elif a < 2800:
        colors[6] = 1    
    elif a < 3200:
        colors[7] = 1
    else:
        all_col += 1 
for color in colors:
    if color == 1:
        kinds += 1
min_c = 0
max_c = 0
min_c = kinds
if kinds == 0:
    min_c = 1
max_c += kinds + all_col
print(str(min_c) + " " + str(max_c))

Submission status: Accepted

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

l = {}
for a in A:
	k = a // 400
	k = min(k, 8)
	if k not in l:
		l[k] = 1
	else:
		l[k] += 1
#print(l)
if 8 in l:
	print(max(1, len(l) - 1), max(1, len(l) - 1 + l[8]))
else:
	print(len(l), len(l))

Submission status: Accepted

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

c = [0] * 8
over = 0

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

print(max(1, sum(c)), sum(c) + over)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
s = list(set(x//400 for x in a))

normal = [x for x in a if x < 3200]
strong = [x for x in a if x >= 3200]

normal_s = set(x // 400 for x in normal)


print(max(len(normal_s), 1), len(normal_s) + len(strong))

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7


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


counts = [0 for i in range(8)]
any = 0
for i in range(N):
    if a[i] >= 3200:
        any += 1
    else:
        ind = a[i] // 400
        counts[ind] += 1

# print(counts)

ans_min = max(1,len(counts)-counts.count(0))
if counts.count(0) != 8:
    ans_max = ans_min+any
else:
    ans_max = any
print(ans_min,ans_max)

Submission status: Accepted

Solution code:
from collections import Counter
from functools import reduce
# import statistics
import bisect
import copy
import fractions
import math
import pprint
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v):
    # ノードに訪れた
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  # そもそもvとv2が辺でつながっていない
            continue
        if visited[v2] == True:  # もう見た
            continue
        dfs(v2)


n = II()
a = LI()
colors = [0] * 9
for rate in a:
    if 1 <= rate <= 399:
        colors[0] += 1
    elif 400 <= rate <= 799:
        colors[1] += 1
    elif 800 <= rate <= 1199:
        colors[2] += 1
    elif 1200 <= rate <= 1599:
        colors[3] += 1
    elif 1600 <= rate <= 1999:
        colors[4] += 1
    elif 2000 <= rate <= 2399:
        colors[5] += 1
    elif 2400 <= rate <= 2799:
        colors[6] += 1
    elif 2800 <= rate <= 3199:
        colors[7] += 1
    else:
        colors[8] += 1
ans = sum(colors[i] >= 1 for i in range(8))
if ans != 0:
    print(str(ans) + ' ' + str(ans + colors[8]))
else:
    print(str('1') + ' ' + str(colors[8]))

Submission status: Accepted

Solution code:

def read_input():
    n = int(input())
    alist = list(map(int, input().split()))

    return n, alist

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

def submit():
    n, alist = read_input()
    rates = [get_rate(a) for a in alist]

    colors = {}
    for r in rates:
        if r == 9:
            continue

        if r not in colors.keys():
            colors[r] = 1
        else:
            colors[r] += 1

    tops = [r for r in rates if r == 9]
    color_n = len(colors)

    if color_n == 0:
        # minではtopは1色に合わせる
        color_min = 1
        color_max = len(tops)
    else:
        # minではtopは既存に色を合わせる
        color_min = color_n
        color_max = color_n + len(tops)

    print('{} {}'.format(color_min, color_max))


if __name__ == '__main__':
    submit()

Submission status: Accepted

Solution code:
c=[0]*9
input()
for a in map(int,input().split()):c[min(a//400,8)]+=1
b=0
for i in range(8):b+=1if c[i]>0 else 0
print(max(b,1), b+c[8])

Submission status: Accepted

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

C = {}
C2 = 0
for a in A:
    for i in range(1, 9):
        if a < 400*i:
            if i in C.keys():
                C[i] +=  1
            else:
                C[i] = 1
            break
    if a >= 3200:
        C2 += 1
if len(C) > 0:
    print(len(C), len(C)+C2)
else:
    print(1, C2)

Submission status: Accepted

Solution code:
n=int(input())
A=[int(i) for i in input().split()]
CL=[0]*9
for a in A:
  cl=min(8,a//400)
  if cl==8:
    CL[cl]+=1
  elif CL[cl]==0:
    CL[cl]=1
if sum(CL[:-1])==0:
  print(1,CL[-1])  
else:
  print(sum(CL[:-1]),sum(CL))