Problem:


Score : 300 points

Problem Statement

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

Rating 1-399 : gray

Rating 400-799 : brown

Rating 800-1199 : green

Rating 1200-1599 : cyan

Rating 1600-1999 : blue

Rating 2000-2399 : yellow

Rating 2400-2799 : orange

Rating 2800-3199 : red

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

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

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

Constraints

1 ≤ N ≤ 100

1 ≤ a_i ≤ 4800

a_i is an integer.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

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

Sample Input 1

4
2100 2500 2700 2700

Sample Output 1

2 2

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

Sample Input 2

5
1100 1900 2800 3200 3200

Sample Output 2

3 5

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

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

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

Sample Input 3

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

Sample Output 3

1 1

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



Sample input:
4
2100 2500 2700 2700


Sample output:
2 2

Submission status: Wrong Answer

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    c_num = 8 # カラー数の上限
    c = [0]*c_num
    all_color = 0
    a = list(int(_) for _ in input().split())
    for i in range(len(a)):
        if(a[i]<3200):
            c[a[i]//400] = 1
        else:
            all_color +=1
    min_color = max(sum(c),1)

    # for i in range(len(c)):
    #     if(c[i]==0 and all_color>0):
    #         c[i] = 1
    #         all_color -=1
    max_color = min(sum(c) + all_color,8)
    print(min_color,max_color)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    c_num = 8 # カラー数の上限
    c = [0]*c_num
    all_color = 0
    a = list(int(_) for _ in input().split())
    for i in range(len(a)):
        if(a[i]<3200):
            c[a[i]//400] = 1
        else:
            all_color +=1
    min_color = max(sum(c),1)
    for i in range(len(c)):
        if(c[i]==0 and all_color>0):
            c[i] = 1
            all_color -=1
    max_color = sum(c)
    print(min_color,max_color)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    c_num = 8 # カラー数の上限
    c = [0]*c_num
    all_color = 0
    a = list(int(_) for _ in input().split())
    for i in range(len(a)):
        if(a[i]<3200):
            c[a[i]//400] = 1
        else:
            all_color +=1
    min = sum(c)
    for i in range(len(c)):
        if(c[i]==0 and all_color>0):
            c[i] = 1
            all_color -=1
    max = sum(c)
    print(min,max)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

l = [0] * 9
p = 0
for i in range(0,n):
    q = a[i] // 400
    if q < 8:
        l[q] = 1
    else:
        l[8] = 1
        p = p + 1

s = sum(l[0:8])
m = max([s,l[8]])
M = min([8,s+p])
print(m,M)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[int(i) for i in input().split()]
rates=[0]*9
for rate in a:
    rates[min(rate//400,8)]+=1
ans=0
for color in rates[:8]:
    ans+=(color!=0)
ansmax=ans+rates[8]
print(ans,ansmax)

Submission status: Wrong Answer

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

l = [0] * 9
p = 0
for i in range(0,n):
    q = a[i] // 400
    if q < 8:
        l[q] = 1
    else:
        l[8] = 1
        p = p + 1

s = sum(l[0:8])
m = min(max([s,l[8]]),8)
M = min(8,s+p)
print(m,M)

Submission status: Wrong Answer

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

l = [0] * 9
for i in range(0,n):
    q = a[i] // 400
    if q < 8:
        l[q] = 1
    else:
        l[8] = l[8] + 1

s = sum(l[0:8])
m = min(max([s,l[8]]),8)
M = min(8,s+l[8])
print(m,M)

Submission status: Wrong Answer

Solution code:
def solve(rates):
	colors = [0 for i in range(8)]
	f = 0
	for rate in rates:
		if rate>=1 and rate<400:
			colors[0] = 1
		elif rate>=400 and rate<800:
			colors[1] = 1
		elif rate>=800 and rate<1200:
			colors[2] = 1
		elif rate>=1200 and rate<1600:
			colors[3] = 1
		elif rate>=1600 and rate<2000:
			colors[4] = 1
		elif rate>=2000 and rate<2400:
			colors[5] = 1
		elif rate>=2400 and rate<2800:
			colors[6] = 1
		elif rate>=2800 and rate<3200:
			colors[7] = 1
		elif rate>=3200:
			f += 1

	if sum(colors)==0:
		ans_min = 1
	else:
		ans_min = sum(colors)
	if sum(colors)+f>=8:
		ans_max = 8
	else:
		ans_max = sum(colors) + f

	print(str(ans_min) + " " + str(ans_max))

		

N = int(input())
a = list(map(int, input().split()))
solve(a)

Submission status: Wrong Answer

Solution code:
def solve(rates):
	colors = [0 for i in range(8)]
	f = 0
	for rate in rates:
		if rate>=1 and rate<400:
			colors[0] = 1
		elif rate>=400 and rate<800:
			colors[1] = 1
		elif rate>=800 and rate<1200:
			colors[2] = 1
		elif rate>=1200 and rate<1600:
			colors[3] = 1
		elif rate>=1600 and rate<2000:
			colors[4] = 1
		elif rate>=2000 and rate<2400:
			colors[5] = 1
		elif rate>=2400 and rate<2800:
			colors[6] = 1
		elif rate>=2800 and rate<3200:
			colors[7] = 1
		elif rate>=3200:
			f += 1

	if sum(colors)==0:
		ans_min = 1
	else:
		ans_min = sum(colors)
	if ans_min+f>=8:
		ans_max = 8
	else:
		ans_max = ans_min + f

	print(str(ans_min) + " " + str(ans_max))

		

N = int(input())
a = list(map(int, input().split()))
solve(a)

Submission status: Wrong Answer

Solution code:
def solve(rates):
	colors = [0 for i in range(8)]
	f = 0
	for rate in rates:
		if rate>=1 and rate<400:
			colors[0] = 1
		elif rate>=400 and rate<800:
			colors[1] = 1
		elif rate>=800 and rate<1200:
			colors[2] = 1
		elif rate>=1200 and rate<1600:
			colors[3] = 1
		elif rate>=1600 and rate<2000:
			colors[4] = 1
		elif rate>=2000 and rate<2400:
			colors[5] = 1
		elif rate>=2400 and rate<2800:
			colors[6] = 1
		elif rate>=2800 and rate<3200:
			colors[7] = 1
		elif rate>=3200:
			f += 1

	ans_min = sum(colors)
	if ans_min+f>=8:
		ans_max = 8
	else:
		ans_max = ans_min + f

	print(str(ans_min) + " " + str(ans_max))

		

N = int(input())
a = list(map(int, input().split()))
solve(a)

Submission status: Wrong Answer

Solution code:
def solve(rates):
	colors = [0 for i in range(8)]
	f = 0
	for rate in rates:
		if rate>=1 and rate<400:
			colors[0] = 1
		elif rate>=400 and rate<800:
			colors[1] = 1
		elif rate>=800 and rate<1200:
			colors[2] = 1
		elif rate>=1200 and rate<1600:
			colors[3] = 1
		elif rate>=1600 and rate<2000:
			colors[4] = 1
		elif rate>=2000 and rate<2400:
			colors[5] = 1
		elif rate>=2400 and rate<2800:
			colors[6] = 1
		elif rate>=2800 and rate<3200:
			colors[7] = 1
		elif rate>=3200:
			f += 1

	ans_min = sum(colors)
	if ans_min+f>8:
		ans_max = 8
	else:
		ans_max = ans_min + f

	print(str(ans_min) + " " + str(ans_max))

		

N = int(input())
a = list(map(int, input().split()))
solve(a)

Submission status: Wrong Answer

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

lst = [0] * 9
for a in A:
    if a >= 3200:
        lst[8] += 1
    for i in range(8):
        if i * 400 <= a < (i+1) * 400:
            lst[i] = 1
            break

ans = 0
for l in lst[:8]:
    if l == 1:
        ans += 1
ans_max = min(8, ans + lst[8])
if ans == 0:
    ans_min = lst[8]
else:
    ans_min = ans


print(ans_min,ans_max)

Submission status: Wrong Answer

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

rank_num = [0] *  9
for item in a:
    item_rank = -1 
    if item < 400:
        item_rank = 0
    elif item < 800:
        item_rank = 1
    elif item < 1200:
        item_rank = 2
    elif item < 1600:
        item_rank = 3
    elif item < 2000:
        item_rank = 4
    elif item < 2400:
        item_rank = 5
    elif item < 2800:
        item_rank = 6
    elif item < 3200:
        item_rank = 7
    else:
        item_rank = 8
    rank_num[item_rank] += 1
print(rank_num)

ans_min = max(8 - rank_num[:-1].count(0), 1)
ans_max = 8 - rank_num[:-1].count(0) + rank_num[-1]
print(ans_min, ans_max)

Submission status: Wrong Answer

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

rank_num = [0] *  9
for item in a:
    item_rank = -1 
    if item < 400:
        item_rank = 0
    elif item < 800:
        item_rank = 1
    elif item < 1200:
        item_rank = 2
    elif item < 1600:
        item_rank = 3
    elif item < 2000:
        item_rank = 4
    elif item < 2400:
        item_rank = 5
    elif item < 2800:
        item_rank = 6
    elif item < 3200:
        item_rank = 7
    else:
        item_rank = 8
    rank_num[item_rank] += 1

ans_min = max(8 - rank_num[:-1].count(0), 1)
ans_max = min(8 - rank_num[:-1].count(0) + rank_num[-1], 8)
print(ans_min, ans_max)

Submission status: Wrong Answer

Solution code:
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n = ni()
a = nl()
l = [0 for _ in range(9)]
for i in range(n):
    if a[i] <= 399:
        l[0] += 1
    elif 400 <= a[i] <= 799:
        l[1] += 1
    elif 800 <= a[i] <= 1199:
        l[2] += 1
    elif 1200 <= a[i] <= 1599:
        l[3] += 1
    elif 1600 <= a[i] <= 1999:
        l[4] += 1
    elif 2000 <= a[i] <= 2399:
        l[5] += 1
    elif 2400 <= a[i] <= 2799:
        l[6] += 1
    elif 2800 <= a[i] <= 3199:
        l[7] += 1
    elif 3200 <= a[i]:
        l[8] += 1
if l[8] == 0:
    print(9 - l.count(0), 9 - l.count(0))
else:
    if l.count(0) == 8:
        print(l[8])
    else:
        print(8 - l.count(0), 8 - l.count(0) + l[8])

Submission status: Wrong Answer

Solution code:
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n = ni()
a = nl()
l = [0 for _ in range(9)]
for i in range(n):
    if a[i] <= 399:
        l[0] += 1
    elif 400 <= a[i] <= 799:
        l[1] += 1
    elif 800 <= a[i] <= 1199:
        l[2] += 1
    elif 1200 <= a[i] <= 1599:
        l[3] += 1
    elif 1600 <= a[i] <= 1999:
        l[4] += 1
    elif 2000 <= a[i] <= 2399:
        l[5] += 1
    elif 2400 <= a[i] <= 2799:
        l[6] += 1
    elif 2800 <= a[i] <= 3199:
        l[7] += 1
    elif 3200 <= a[i]:
        l[8] += 1
if l[8] == 0:
    print(9 - l.count(0), 9 - l.count(0))
else:
    print(8 - l.count(0), 8 - l.count(0) + l[8])

Submission status: Wrong Answer

Solution code:
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n = ni()
a = nl()
l = [0 for _ in range(9)]
for i in range(n):
    if a[i] <= 399:
        l[0] += 1
    elif 400 <= a[i] <= 799:
        l[1] += 1
    elif 800 <= a[i] <= 1199:
        l[2] += 1
    elif 1200 <= a[i] <= 1599:
        l[3] += 1
    elif 1600 <= a[i] <= 1999:
        l[4] += 1
    elif 2000 <= a[i] <= 2399:
        l[5] += 1
    elif 2400 <= a[i] <= 2799:
        l[6] += 1
    elif 2800 <= a[i] <= 3199:
        l[7] += 1
    elif 3200 <= a[i]:
        l[8] += 1
if l[8] > 0:
    print(8 - l.count(0), 8 - l.count(0) + l[8])
else:
    print(9 - l.count(0), 9 - l.count(0))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [ int(i) for i in input().split() ]
cols = [ 0 for i in range(8) ]
col2 = [ 0 for i in range(8) ]
for i in s:
    if i <= 399:
        cols[0] = True
        col2[0] = True
    elif 400<= i <= 799:
        cols[1] = True
        col2[1] = True
    elif 800 <= i <= 1199:
        cols[2] = True
        col2[2] = True
    elif 1200<= i <= 1599:
        cols[3] = True
        col2[3] = True
    elif 1600 <= i <= 1999:
        cols[4] = True
        col2[4] = True
    elif 2000 <= i <= 2399:
        cols[5] = True
        col2[5] = True
    elif 2400 <= i <= 2799:
        cols[6] = True
        col2[6] = True
    elif 2800 <= i <= 3199:
        cols[7] = True
        col2[7] = True
    else:
        for j in range(8):
            if col2[j] == False:
                col2[j] = True
                break

print(sum(cols),sum(col2))

Submission status: Wrong Answer

Solution code:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
import math
#n=int(input())
#li=input().split()
#S=input()

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

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

for i in range(n):
    a=math.floor(lis[i]/400)
    if a<8:
        l[a]=1
    else:
        l[-1]+=1
if sum(l[:8])>=l[8]:
    print(sum(l[:8]),sum(l))
else:
    print(sum(l)-sum(l[:8]),sum(l))

Submission status: Wrong Answer

Solution code:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
import math
#n=int(input())
#li=input().split()
#S=input()

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

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

for i in range(n):
    a=math.floor(lis[i]/400)
    if a<8:
        l[a]=1
    else:
        l[-1]+=1

print(sum(l[:8]),sum(l))

Submission status: Wrong Answer

Solution code:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
import math
#n=int(input())
#li=input().split()
#S=input()

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

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

for i in range(n):
    a=math.floor(lis[i]/400)
    if a<8:
        l[a]=1
    else:
        l[-1]+=1

ans=str(sum(l[:8]))+" "+str(sum(l))

print(ans)

Submission status: Wrong Answer

Solution code:
#13:27
N = int(input())
A = list(map(int,input().split()))
ex_red = [0]*8
red_cnt = 0

for i in range(8):#0-7
    for j in range(N):
        if 400*i<=A[j] and A[j]<400*(i+1):
            ex_red[i]+=1
n = 0
for i in range(N):
    if 3200 <= A[i]:
        n += 1
not_red_color = 0
c = 0
for i in range(8):
    if ex_red[i] > 0:
        c += 1
#print(c)#soreigai_count
#print(n)#red_count

max_ans = min(n + c, 8)

#min_ans
if c >= 1:
    min_ans = c
elif c == 0:
    min_ans = 1
print(min_ans, max_ans)

Submission status: Wrong Answer

Solution code:
#13:27
N = int(input())
A = list(map(int,input().split()))
ex_red = [0]*8
red_cnt = 0

for i in range(8):#0-7
    for j in range(N):
        if 400*i<=A[j] and A[j]<400*(i+1):
            ex_red[i]+=1

for i in range(N):
    if 3200 <= A[i]:
        red_cnt += 1
not_red_color = 0
for i in range(8):
    if ex_red[i] > 0:
        not_red_color += 1
    
zero_num = 8 - not_red_color

if zero_num >= red_cnt:
    ans = red_cnt + not_red_color
else:
    ans = zero_num + not_red_color

print(not_red_color,ans)

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict
import numpy as np

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

scores = OrderedDict()
scores[1] = 0
scores[400] = 0
scores[800] = 0
scores[1200] = 0
scores[1600] = 0
scores[2000] = 0
scores[2400] = 0
scores[2800] = 0
scores[3200] = 0

for record in a:
  for s in list(scores.keys())[::-1]:
    if record>=s:
      scores[s] += 1
      break
      
colors = np.sum([
  int(v>0) for k, v in scores.items() if k<3200])

if scores[3200]>0 and colors==0:
  min_colors = 1
else: 
  min_colors = colors
max_colors = colors + scores[3200]

print(colors, colors+scores[3200])

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict
import numpy as np

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

scores = OrderedDict()
scores[1] = 0
scores[400] = 0
scores[800] = 0
scores[1200] = 0
scores[1600] = 0
scores[2000] = 0
scores[2400] = 0
scores[2800] = 0
scores[3200] = 0

for record in a:
  for s in list(scores.keys())[::-1]:
    if record>=s:
      scores[s] += 1
      break
      
colors = np.sum([int(v>0) for k, v in scores.items() if k<3200])
print(colors, colors+scores[3200])

Submission status: Wrong Answer

Solution code:
n=int(input())
s = list(map(int,input().split()))
li=[0]*9
for i in range(n):
  if s[i]<3200:
    b=s[i]//400
    li[b]+=1
  else:
    li[8]+=1

ans=0
for j in range(8):
  if li[j]!=0:
    ans+=1

c=ans+li[8]

#if c<=8:
print(ans,c)
#else:
  #print(ans,8)

Submission status: Wrong Answer

Solution code:
n=int(input())
s = list(map(int,input().split()))
li=[0]*9
for i in range(n):
  if s[i]<3200:
    b=(s[i]+1)//400
    li[b]+=1
  else:
    li[8]+=1

ans=0
for j in range(8):
  if li[j]!=0:
    ans+=1

c=ans+li[8]

#if c<=8:
print(ans,c)
#else:
  #print(ans,8)

Submission status: Wrong Answer

Solution code:
n=int(input())
s = list(map(int,input().split()))
li=[0]*9
for i in range(n):
  if s[i]<3200:
    b=(s[i]+1)//400
    li[b]+=1
  else:
    li[8]+=1

ans=0
for j in range(8):
  if li[j]!=0:
    ans+=1

c=ans+li[8]

if c<=8:
  print(ans,c)
else:
  print(ans,8)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
l = [0]*8
red = 0
for i in range(n):
    if a[i]<=399:
        l[0]+=1
    elif a[i]<=799:
        l[1]+=1
    elif a[i]<=1199:
        l[2]+=1
    elif a[i]<=1599:
        l[3]+=1
    elif a[i]<=1999:
        l[4]+=1
    elif a[i]<=2399:
        l[5]+=1
    elif a[i]<=2799:
        l[6]+=1
    elif a[i]<=3199:
        l[7]+=1
    else:
        red+=1
z = l.count(0)
if z==0:
    print(8,8)
elif 8-z>=red:
    print(8-z,min(8-z+red,8))
else:
    print(8-z+(red-(8-z)),min(8-z+red,8))

Submission status: Wrong Answer

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

n = int(input())
rated = list(map(int, input().split()))
rated = list(map(rate, rated))
count = 0
for i in rated:
    if i == 8:
        count += 1
if count:
    print(max(1, len(set(rated))-1), end=" ")
    print(max(1, min(8, len(list(set(rated)))+count-1)))
else:
    print(max(1, len(set(rated))), end=" ")
    print(max(1, min(8, len(list(set(rated))))))

Submission status: Wrong Answer

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

n = int(input())
rated = list(map(int, input().split()))
rated = list(map(rate, rated))
print(rated)
count = 0
for i in rated:
    if i == 8:
        count += 1
if count:
    print(max(1, len(set(rated))-1), end=" ")
    print(max(1, min(8, len(list(set(rated)))+count-1)))
else:
    print(max(1, len(set(rated))), end=" ")
    print(max(1, min(8, len(list(set(rated))))))

Submission status: Wrong Answer

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

n = int(input())
rated = list(map(int, input().split()))
rated = list(map(rate, rated))
count = 0
for i in rated:
    if i == 8:
        count += 1
if count:
    print(len(set(rated))-1, end=" ")
    print(min(8, len(list(set(rated)))+count-1))
else:
    print(len(set(rated)), end=" ")
    print(min(8, len(list(set(rated)))+count))

Submission status: Wrong Answer

Solution code:
import bisect
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
color_list = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
color_dict = defaultdict(int)
red_count = 0
for i in a:
  idx = bisect.bisect_right(color_list, i)
  if 1 <= idx <= 8:
    color_dict[idx] += 1
  elif idx == 9:
    red_count += 1
print(len(color_dict), len(color_dict)+red_count)

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

rate = [0]*8
f = 0

for i in range(n):
    if 3199 < a[i]:
        f += 1
    else:
        rate[int((a[i]/400))] = 1

s = sum(rate)
min = s if 0 < s else 1
max = s+f if s+f <= 8 else 8

print(min, max)

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

rate = [0]*8
f = 0

for i in range(n):
    if 3199 < a[i]:
        f += 1
    else:
        rate[int((a[i]/400))] = 1

s = sum(rate)
min = s
max = s+f if s+f <= 8 else 8

print(min, max)

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

rate = [0]*8
f = 0

for i in range(n):
    if 3199 < a[i]:
        f += 1
    else:
        rate[int((a[i]/400))] = 1

s = sum(rate)
min = s if f <= s else f if f <= 8 else 8
max = s+f if s+f <= 8 else 8

print(min, max)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    
    wildcard = 0
    color = [0] * 8
    for a in A:
        if a < 400:
            color[0] = 1
        elif a < 800:
            color[1] = 1
        elif a < 1200:
            color[2] = 1
        elif a < 1600:
            color[3] = 1
        elif a < 2000:
            color[4] = 1
        elif a < 2400:
            color[5] = 1
        elif a < 2800:
            color[6] = 1
        elif a < 3200:
            color[7] = 1
        else:
            wildcard += 1

    nc = sum(color)
    print(max(1, nc), min(8, nc + wildcard))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    
    wildcard = 0
    color = [0] * 8
    for a in A:
        if a < 400:
            color[0] = 1
        elif a < 800:
            color[1] = 1
        elif a < 1200:
            color[2] = 1
        elif a < 1600:
            color[3] = 1
        elif a < 2000:
            color[4] = 1
        elif a < 2400:
            color[5] = 1
        elif a < 2800:
            color[6] = 1
        elif a < 3200:
            color[7] = 1
        else:
            wildcard += 1

    nc = sum(color)
    print(nc, min(8, nc + wildcard))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
x = {}
for i in range(n):
    t = min(a[i] // 400, 8)
    if t in x.keys():
        x[t] += 1
    else:
        x[t] = 1
m = 0
l = len(x.keys())
if 8 in x.keys():
    ans = [l - 1, l - 1 + x[8]]
else:
    ans = [l, l]
print(*ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
a = Counter(list(map(lambda x: x//400, map(int, input().split()))))

c = n = 0
for key in [0,1,2,3,4,5,6,7]:
    if a[key]:
        c += 1
        
for key in [8,9,10,11,12]:
    n += a[key]
        
max_n = min(8, c+n)
if c:
    min_n = c
else:
    min_n = 1
print(min_n, max_n)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
a = Counter(list(map(lambda x: x//400, map(int, input().split()))))

c = n = 0
for key in [0,1,2,3,4,5,6,7]:
    if a[key]:
        c += 1
        
for key in [8,9,10,11,12]:
    if a[key]:
        n += 1
        
max_n = min(8, c+n)
if c:
    min_n = c
else:
    min_n = 1
print(max_n, min_n)

Submission status: Wrong Answer

Solution code:
def calc(n):
    n_list = list(range(399, 3300, 400))
    for i, j in enumerate(n_list):
        if (n < j) & (n >= j - 399):
            return str(i)
    if n >= 3200:
        return str(8)

import collections
n = int(input())
a = [int(i) for i in input().split()]
a_list = [calc(a_) for a_ in a]
l = collections.Counter(a_list)
if "8" in l.keys():
    min_ans = len(list(set(a_list))) - 1
else:
    min_ans = len(list(set(a_list)))    
ans = l["8"] + min_ans
max_ans = ans if ans <= 8 else 8
t = " ".join([str(min_ans), str(max_ans)])
print(t)

Submission status: Wrong Answer

Solution code:
def calc(n):
    n_list = list(range(399, 3300, 400))
    for i, j in enumerate(n_list):
        if (n < j) & (n >= j - 399):
            return str(i)
    else:
        return str(8)

import collections
n = int(input())
a = [int(i) for i in input().split()]
a_list = [calc(a_) for a_ in a]
l = collections.Counter(a_list)
if "8" in l.keys():
    min_ans = len(list(set(a_list))) - 1
else:
    min_ans = len(list(set(a_list)))    
ans = l["8"] + min_ans
max_ans = ans if ans <= 8 else 8
t = " ".join([str(min_ans), str(max_ans)])
print(t)

Submission status: Wrong Answer

Solution code:
def calc(n):
    n_list = list(range(399, 3300, 400))
    for i, j in enumerate(n_list):
        if (n < j) & (n >= j - 399):
            return str(i)
    else:
        return str(8)

import collections
n = int(input())
a = [int(i) for i in input().split()]
a_list = [calc(a_) for a_ in a]
l = collections.Counter(a_list)
if "8" in l.keys():
    min_ans = len(list(set(a_list))) - 1
else:
    min_ans = len(list(set(a_list)))    
ans = l["8"] + min_ans
max_ans = ans if ans < 8 else 8
t = " ".join([str(min_ans), str(max_ans)])
print(t)

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict
N = int(input())
A = list(map(int, input().split()))
R = {"gray": 0, "brown": 0, "green": 0, "light": 0, "blue": 0, "yellow": 0, "orange": 0, "red": 0}
S = OrderedDict([("gray", 400), ("brown", 800), ("green", 1200), ("light", 1600), ("blue", 2000), ("yellow", 2400), ("orange", 2800), ("red", 3200)])
for a in A:
    for r, s in S.items():
        if a < s:
            R[r] += 1
            break
num = len([r for r, n in R.items() if n != 0])
other = N - sum([n for r, n in R.items() if n != 0])
if num == 0:
    print(1, N)
    exit()
print(num, min(8, num + other))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
v = [0]*9
n = int(input())
a = list(map(int,input().split()))
for i in a:
  idx = i//400
  if idx >= 8: idx = 8
  v[idx] += 1
r = 0
for i in range(8):
  if v[i] >= 1: r+= 1
print(r, r+v[8])

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
color =set()
t = 0
for i in range(n):
    if a[i] <=399:
        a[i] = "gray"
    elif a[i]<= 799:
        a[i] = "brown"
    elif a[i]<=1199:
        a[i] = "green"
    elif a[i] <= 1599:
        a[i] = "water"
    elif a[i] <= 1999:
        a[i] ="blue"
    elif a[i] <=2399:
        a[i] ="yellow"
    elif a[i] <=2799:
        a[i] ="daidai"
    elif a[i] <= 3199:
        a[i] = "red"
    else:
        a[i] = "target"
        t += 1
for i in range(n):
    if a[i] != "target":
       color.add(a[i])
    else:
        continue
print(len(list(color)),len(list(color))+t)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
A2 = list(map(lambda a: a // 400, A))

G1 = [a for a in A2 if a < 8]
min = len(set(G1))
max = min+len(A2)-len(G1)
print(min, max)

Submission status: Wrong Answer

Solution code:
N=int(input())
rate=[0]*8
tourist=0
a=list(map(int,input().split()))
for i in a:
  if 1<=i<=399:
    rate[0]+=1
  elif 400<=i<=799:
    rate[1]+=1
  elif 800<=i<=1199:
    rate[2]+=1
  elif 1200<=i<=1599:
    rate[3]+=1
  elif 1600<=i<=1999:
    rate[4]+=1
  elif 2000<=i<=2399:
    rate[5]+=1
  elif 2400<=i<=2799:
    rate[6]+=1
  elif 2800<=i<=3199:
    rate[7]+=1
  elif i<=3200:
    tourist+=1
print(max(8-rate.count(0),1),max(1,8-rate.count(0)+tourist))