Problem:


Score : 300 points

Problem Statement

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

Rating 1-399 : gray

Rating 400-799 : brown

Rating 800-1199 : green

Rating 1200-1599 : cyan

Rating 1600-1999 : blue

Rating 2000-2399 : yellow

Rating 2400-2799 : orange

Rating 2800-3199 : red

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

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

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

Constraints

1 ≤ N ≤ 100

1 ≤ a_i ≤ 4800

a_i is an integer.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

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

Sample Input 1

4
2100 2500 2700 2700

Sample Output 1

2 2

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

Sample Input 2

5
1100 1900 2800 3200 3200

Sample Output 2

3 5

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

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

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

Sample Input 3

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

Sample Output 3

1 1

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



Sample input:
4
2100 2500 2700 2700


Sample output:
2 2

Submission status: Accepted

Solution code:
import sys
import bisect
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
ls = [i * 400 - 1 for i in range(1, 9)]
_set = set()
n_max = 0
for a in a_ls:
    ind = bisect.bisect_left(ls ,a)
    if ind == 8:
        n_max += 1
    else:
        _set.add(ind)
_min = len(_set) if len(_set) > 0 else len(_set) + (n_max > 0)
print(_min, len(_set) + n_max)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(int(x)/400) for x in input().split()]
b = [x if x <= 7 else 8 for x in a]

ans = len(set(b))
if (8 in b):
   ans -= 1
   ans2 = b.count(8) + ans
   if (ans == 0):
      print(1, ans2)
   else:
      print(ans, ans2)
else:
   print(ans, ans)

Submission status: Accepted

Solution code:
color_list = [0]*9

x = input()

score_lists = list(map(int, input().split()))

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

ans_min = color_list[0] + color_list[1] + color_list[2] + color_list[3] + color_list[4]\
     + color_list[5] + color_list[6] + color_list[7]

if ans_min == 0 and color_list[8] != 0:
    ans_min = 1

ans_max = color_list[0] + color_list[1] + color_list[2] + color_list[3] + color_list[4]\
     + color_list[5] + color_list[6] + color_list[7] + color_list[8]

print(ans_min, ans_max)

Submission status: Accepted

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

color = set()
mx = 0

for i in a:
    if 1 <= i <= 399:
        color.add('a')
    elif 400 <= i <= 799:
        color.add('b')
    elif 800 <= i <= 1199:
        color.add('c')
    elif 1200 <= i <= 1599:
        color.add('d')
    elif 1600 <= i <= 1999:
        color.add('e')
    elif 2000 <= i <= 2399:
        color.add('f')
    elif 2400 <= i <= 2799:
        color.add('g')
    elif 2800 <= i <= 3199:
        color.add('h')
    elif 3200 <= i:
        mx += 1

if len(color) == 0 and mx == 1:
    print(1, 1)
    exit()
if len(color) == 0 and mx >= 1:
    print(1, mx)
    exit()
if len(color):
    cn = len(color)

cx = cn + mx

print(cn, cx)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
a = [int(i) for i in input().split()]
li = [False] * 8
count_over = 0
for i in range(N) :
    if 1 <= a[i] <= 399 :
        if li[0] == False :
            li[0] = True
    if 400 <= a[i] <= 799 :
        if li[1] == False :
            li[1] = True
    if 800 <= a[i] <= 1199 :
        if li[2] == False :
            li[2] = True
    if 1200 <= a[i] <= 1599 :
        if li[3] == False :
            li[3] = True
    if 1600 <= a[i] <= 1999 :
        if li[4] == False :
            li[4] = True
    if 2000 <= a[i] <= 2399 :
        if li[5] == False :
            li[5] = True
    if 2400 <= a[i] <= 2799 :
        if li[6] == False :
            li[6] = True
    if 2800 <= a[i] <= 3199 :
        if li[7] == False :
            li[7] = True
    if 3200 <= a[i] :
        count_over += 1
sum = 0
for i in range(8) :
    if li[i] :
        sum+=1
maxx = sum+count_over
minn = 0
if sum == 0 :
    minn = 1
else :
    minn = sum
print(minn,maxx)

Submission status: Accepted

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

if sum(colors[0:8]) == 0 and colors[8] >= 1:
    MIN = 1
else:
    MIN = sum(colors[0:8])
MAX = sum(colors)

print(MIN, MAX)

Submission status: Accepted

Solution code:
from collections import defaultdict
N = int(input())
rates = [int(i) for i in input().split()]
# N = 4
# rates = [2100, 2500, 2700, 2700]

color_nums = defaultdict(int)

for rate in rates:
    if rate <= 399:
        color_nums['灰'] += 1
    elif rate <= 799:
        color_nums['茶'] += 1
    elif rate <= 1199:
        color_nums['緑'] += 1
    elif rate <= 1599:
        color_nums['水'] += 1
    elif rate <= 1999:
        color_nums['青'] += 1
    elif rate <= 2399:
        color_nums['黄'] += 1
    elif rate <= 2799:
        color_nums['橙'] += 1
    elif rate <= 3199:
        color_nums['赤'] += 1
    else:
        color_nums['自由'] += 1

free_num = color_nums['自由']
if free_num == 0:
    # 自由に変えられる人がいない場合
    # -1 は free_num = color_nums['自由']で増えてしまったので...
    print(len(color_nums)-1, len(color_nums)-1)
elif free_num == N:
    # 自由に変えられる人しかいない場合
    print(1, free_num)
elif free_num != N:
    # 自由な人と混在
    tmp = dict(color_nums)  # コピーを作る
    tmp.pop('自由')
    l_tmp = len(tmp)
    min_num = l_tmp
    max_num = l_tmp + free_num
    print(min_num, max_num)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i)//400 for i in input().split() if int(i)<3200]
x = len(set(a)) 
y = n-len(a) 

if x == 0:
    print(1,y)
else:
    print(x,x+y)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
col=[False]*8
ans=0
for i in a:
    if 1<=i<=399:
        col[0]=True
    elif i<=799:
        col[1]=True
    elif i<=1199:
        col[2]=True
    elif i<=1599:
        col[3]=True
    elif i<=1999:
        col[4]=True
    elif i<=2399:
        col[5]=True
    elif i<=2799:
        col[6]=True
    elif i<=3199:
        col[7]=True
    else:
        ans+=1
ans1=0
for i in col:
    if i:
        ans1+=1
print(max(ans1,1),ans1+ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

dic = defaultdict(int)

for x in a:
    if 1 <= x <= 399:
        dic["灰"] += 1
    if 400 <= x <= 799:
        dic["茶"] += 1
    if 800 <= x <= 1199:
        dic["緑"] += 1
    if 1200 <= x <= 1599:
        dic["水"] += 1
    if 1600 <= x <= 1999:
        dic["青"] += 1
    if 2000 <= x <= 2399:
        dic["黃"] += 1
    if 2400 <= x <= 2799:
        dic["橙"] += 1
    if 2800 <= x <= 3199:
        dic["赤"] += 1
    if 3200 <= x:
        dic["強い"] += 1
kind = len(dic.keys())
if kind == 1 and bool(dic["強い"]):
    print(1, dic["強い"])
else:
    print(kind - bool(dic["強い"]), kind - bool(dic["強い"]) + dic["強い"])

Submission status: Accepted

Solution code:
r = list()
r.append((1, 399))
r.append((400, 799))
r.append((800, 1199))
r.append((1200, 1599))
r.append((1600, 1999))
r.append((2000, 2399))
r.append((2400, 2799))
r.append((2800, 3199))

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

count = [0 for i in range(0, len(r) + 1)]
for ai in a:
    add = False
    for i in range(0, len(r)):
        if r[i][0] <= ai <= r[i][1]:
            count[i] += 1
            add = True
    if not add:
        count[len(count) - 1] += 1

ans_min = 0
for c in range(0, len(count) - 1):
    if count[c] > 0:
        ans_min += 1

if ans_min > 0:
    ans_max = ans_min + count[len(count) - 1]
elif count[len(count) - 1] > 0:
    ans_min = 1
    ans_max = count[len(count) - 1]
else:
    ans_max = 0

print("%d %d" % (ans_min, ans_max))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
var = [0]*8
clown = 0
for i in a:
  if i >= 3200:
    clown += 1
  else:
    var[i//400] = 1
if sum(var) > 0:
  print(sum(var), sum(var)+clown)
else:
  print(1, sum(var)+clown)

Submission status: Accepted

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

n=int(input())
a=list(map(int,input().split()))
b={}
cnt=0
for i in a:
    if i<3200:
        b[i//400]=1
    else:
        cnt+=1
if sum(b.values())==0:
    print(1,cnt)
    exit()
print(sum(b.values()),sum(b.values())+cnt)

Submission status: Accepted

Solution code:


import numpy as np
import fractions as fra


input()
s=set()
c=0
for y in input().split():
    x=int(y)//400
    if(x>=8):
        c+=1
    else:
        s.add(x)

#print(s)
ls=len(s)
print(max(1,ls),end=" ")
print(ls+c)

Submission status: Accepted

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

scr = [400,800,1200,1600,2000,2400,2800,3200,5000]
li = [0,0,0,0,0,0,0,0,0]

for i in range(n):
    for j in range(len(scr)):
        if a[i] < scr[j]:
            li[j] += 1
            break

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

if li[8]:
    ans_M = min(ans+li[8],10**9)
    ans_m = max(ans,1)
else:
    ans_M = ans
    ans_m = ans

print(ans_m,ans_M)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
A = [e//400 for e in A]
from collections import Counter
D = Counter(A)
ans = 0
add = 0
for key,value in D.items():
    if key >= 8:
        add += value
    else:
        if value > 0:
            ans += 1
print(max(ans,1),ans+add)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
division = {str(i):0 for i in range(9)}
for i in a:
    x = i // 400
    if x > 8:
        x = 8
    division[str(x)] += 1
ans = 0
check = 1
for i in range(8):
    if division[str(i)] != 0:
        ans += 1
        check = 0
min_ans = ans + check
max_ans = ans + division['8']
print(min_ans,max_ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
r=set()
free=0
for x in a:
    y=x//400
    if y>=8:
        free+=1
        y=8
    r.add(y)
len_r=len(r)
if len_r==1 and free>0:
    print(1,free)
elif len_r>1 and free>0:
    print(len_r-1,len_r-1+free)
else:
    print(len_r,len_r)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
col = [0]*9
for i in range(N):
    if a[i] <=399:
        col[0] = 1
    elif a[i] <= 799:
        col[1] = 1
    elif a[i] <= 1199:
        col[2] = 1
    elif a[i] <= 1599:
        col[3] = 1
    elif a[i] <= 1999:
        col[4] = 1
    elif a[i] <= 2399:
        col[5] = 1
    elif a[i] <= 2799:
        col[6] = 1
    elif a[i] <= 3199:
        col[7] = 1
    else: col[8] += 1
ansmax = sum(col)
if col[8]>0:
    ansmin = max(sum(col[:8]),1)
else: ansmin = sum(col[:8])
print(ansmin, ansmax)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))
C=[0]*8
num_god=0
for a in A:
    if a//400<8:
        C[a//400]+=1
    else:
        num_god+=1
ans=0
for a in C:
    if a!=0:
        ans+=1
cnt=0
for a in C:
    if a==0:
        cnt+=1
if cnt==8:
    Min=1
else:
    Min=ans
Max=ans+num_god
print(Min,Max)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b={}
f=0
for i in range(n):
    if a[i]<3200:
        b[a[i]//400]=a[i]
    else:
        f+=1
print(max(len(b),1),len(b)+f)

Submission status: Accepted

Solution code:
N = int(input())
A = list((map(int, input().split())))
# 400区切り

over = 0
under = [False]*8 
for a in A:
  if a < 3200:
    under[a//400] = True
  else:
    over += 1

min_ = max(sum(under), 1)
max_ = sum(under)+over

print(min_, max_)

Submission status: Accepted

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

if x[:-1].count(1)!=0:
    print(x[:-1].count(1),end=" ")
else:
    print(1,end=" ")
print(x[:-1].count(1)+x[-1])

Submission status: Accepted

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

ans = [False] * 8
tmp = 0
for i in a:
    if i > 3199:
        tmp += 1
    else:
        ans[i // 400] = True
print(max(sum(ans),1), sum(ans) + tmp)

Submission status: Accepted

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

ans = [0] * 9

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

cnt = 0

for j in range(8):
	if ans[j] != 0:
		cnt += 1
		
print(max(cnt, 1), cnt + ans[8])

Submission status: Accepted

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

rate = []
anycol = 0
for i in As : 
  if i >= 3200 : 
    anycol += 1 
  else : 
     rate.append( i // 400 )
 
count = len( set(rate) )
 
print( max(count, 1), count+anycol )

Submission status: Accepted

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

red=0
rate=[]

for a in A:
    if(a>=3200):
        red+=1
    else:
        rate.append(a//400)
        
cnt=len(set(rate))
print(max(1,cnt),cnt+red)

Submission status: Accepted

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

rainbow = 0
color = [0 for i in range(8)]

for i in range(N):
    if a[i] <= 399:
        color[0] = 1
    elif a[i] <= 799:
        color[1] = 1
    elif a[i] <= 1199:
        color[2] = 1
    elif a[i] <= 1599:
        color[3] = 1
    elif a[i] <= 1999:
        color[4] = 1
    elif a[i] <= 2399:
        color[5] = 1
    elif a[i] <= 2799:
        color[6] = 1
    elif a[i] <= 3199:
        color[7] = 1
    else:
        rainbow += 1
        
ans = 0
for i in range(len(color)):
    if color[i] == 1:
        ans += 1

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

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
res=set()
free=0
for i in range(len(a)):
  if a[i]<400:
    res.add("gray")
  elif a[i]<800:
    res.add("brown")
  elif a[i]<1200:
    res.add("green")
  elif a[i]<1600:
    res.add("water")
  elif a[i]<2000:
    res.add("blue")
  elif a[i]<2400:
    res.add("yellow")
  elif a[i]<2800:
    res.add("orange")
  elif a[i]<3200:
    res.add("red")
  else:
    free+=1

col=len(res)
print(col if col>0 else 1,col+free)

Submission status: Accepted

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

Submission status: Accepted

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

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

rate_count_list = [0] * 8   # 各色の人数
count_over_red = 0          # 赤色以上の人数

for a in a_list:

    # aの色を判定
    # 赤色以上の場合
    if a >= 3200:
        count_over_red += 1

    # 灰色から順に見ていく
    else:
        for i in range(8):
            if i == 0:
                min_in_rate = 1
            else:
                min_in_rate = 400 * i

            max_in_rate = 400 * (i + 1)

            if min_in_rate <= a < max_in_rate:
                rate_count_list[i] = 1
                break

ans_min = sum(rate_count_list)

ans_max = ans_min + count_over_red

print(str(max(ans_min, 1)) + ' ' + str(ans_max))

Submission status: Accepted

Solution code:
N = int(input())
array = [int(i) for i in input().split()]
ans_array = [0]*8
upper_num = 0

for i in array:
  if 1 <= i <= 399:
    ans_array[0] =  1
  elif 400 <= i <= 799:
    ans_array[1] =  1
  elif 800 <= i <= 1199:
    ans_array[2] =  1
  elif 1200 <= i <= 1599:
    ans_array[3] =  1
  elif 1600 <= i <= 1999:
    ans_array[4] =  1
  elif 2000 <= i <= 2399:
    ans_array[5] =  1
  elif 2400 <= i <= 2799:
    ans_array[6] =  1
  elif 2800 <= i <= 3199:
    ans_array[7] =  1
  else:
    upper_num += 1
    
min_num = max(sum(ans_array),1)
max_num = sum(ans_array) + upper_num

print(min_num, max_num)

Submission status: Accepted

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

red = 0
rate = []

for a in A:
    if(a>=3200):
        red += 1
    else:
        rate.append(min(a//400,7))

cnt = len(set(rate))

print(max(1,cnt),cnt+red)

Submission status: Accepted

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

conds = [400*i for i in range(1,9)]
colors = set()
frees = 0
for i in range(N):
    for c in conds:
        if A[i] < c:
            colors.add(c)
            break
    else:
        frees += 1
clen = len(colors)
print(clen if clen else 1, clen+frees)

Submission status: Accepted

Solution code:
#レート
#1-399：灰色
#400-799：茶色
#800-1199：緑色
#1200-1599：水色
#1600-1999：青色
#2000-2399：黄色 
#2400-2799：橙色
#2800-3199：赤色

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

colors = []
color = ""
another = 0

for point in scores:
  if point <= 399:
    color = "gray"
    if color not in colors:
      colors.append(color)
  elif point <= 799:
    color = "brown"
    if color not in colors:
      colors.append(color)
  elif point <= 1199:
    color = "green"
    if color not in colors:
      colors.append(color)
  elif point <= 1599:
    color = "sky"
    if color not in colors:
      colors.append(color)
  elif point <= 1999:
    color = "blue"
    if color not in colors:
      colors.append(color)
  elif point <= 2399:
    color = "yellow"
    if color not in colors:
      colors.append(color)
  elif point <= 2799:
    color = "orange"
    if color not in colors:
      colors.append(color)
  elif point <= 3199:
    color = "red"
    if color not in colors:
      colors.append(color)
  elif point > 3199:
    another += 1
    
ans = len(colors)
if ans == 0:
  print(1,another)
else:
  print(ans,ans + another)

Submission status: Accepted

Solution code:
N=int(input())
A=[int(x) for x in input().split()]
B=[0]*9
for i in range(N):
  R=A[i]//400
  if R>8:
    R=8
  B[R] +=1
answer_min=0
for i in range(8):
  if not B[i]==0:
    answer_min +=1
answer_max=answer_min+B[8]
if answer_min==0:
  answer_min=1
print(answer_min,answer_max)

Submission status: Accepted

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

max_=sum(l)
    
if sum(l[:-1])==0:
    min_=1
else:
    min_=sum(l[:-1])
    
print(min_,max_)

Submission status: Accepted

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

Colors = [0 for _ in range(8)]
any_color = 0

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

ans_min = max(sum(Colors), 1)
ans_max = sum(Colors) + any_color

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
import collections
N = int(input())
a = [int(x) for x in input().split()]
rate = [0] * 8
flag = 0
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 3200 <= i:
        flag += 1
color_count = rate.count(1)
if flag:
    ans = [max(1, color_count),color_count + flag]
    print(* ans)
else:
    ans = [color_count, color_count]
    print(* ans)

Submission status: Accepted

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

color = set()
cnt = 0
for i in a:
  if 1 <= i <= 399:
    color.add("gray")
  elif 400 <= i <= 799:
    color.add("brown")
  elif 800 <= i <= 1199:
    color.add("green")
  elif 1200 <= i <= 1599:
    color.add("water")
  elif 1600 <= i <= 1999:
    color.add("blue")
  elif 2000 <= i <= 2399:
    color.add("yellow")
  elif 2400 <= i <= 2799:
    color.add("orange")
  elif 2800 <= i <= 3199:
    color.add("red")
  else:
    cnt += 1

print("%s %s" %(max(len(color),1), len(color) + cnt))

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] <= 399:
        color[0] += 1
    elif 400 <= A[i] and A[i] <= 799:
        color[1] += 1
    elif 800 <= A[i] and A[i] <= 1199:
        color[2] += 1
    elif 1200 <= A[i] and A[i] <= 1599:
        color[3] += 1
    elif 1600 <= A[i] and A[i] <= 1999:
        color[4] += 1
    elif 2000 <= A[i] and A[i] <= 2399:
        color[5] += 1
    elif 2400 <= A[i] and A[i] <= 2799:
        color[6] += 1
    elif 2800 <= A[i] and A[i] <= 3199:
        color[7] += 1
    else:
        color[8] += 1

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

ans = [max(1,num), num + color[8]]
print(" ".join(str(s) for s in ans))

Submission status: Accepted

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

grey = 0
brown = 0
green = 0
cyan = 0
blue = 0
yellow = 0
orange = 0
red = 0

minimo = 0
maximo = 0
coresLivres = 8

for valor in i:
    if 1 <= valor <= 399:
        if grey == 0:
            minimo += 1
            coresLivres -= 1
        grey += 1
    elif 400 <= valor <= 799:
        if brown == 0:
            minimo += 1
            coresLivres -= 1
        brown += 1
    elif 800 <= valor <= 1199:
        if green == 0:
            minimo += 1
            coresLivres -= 1
        green += 1
    elif 1200 <= valor <= 1599:
        if cyan == 0:
            minimo += 1
            coresLivres -= 1
        cyan += 1
    elif 1600 <= valor <= 1999:
        if blue == 0:
            minimo += 1
            coresLivres -= 1
        blue += 1
    elif 2000 <= valor <= 2399:
        if yellow == 0:
            minimo += 1
            coresLivres -= 1
        yellow += 1
    elif 2400 <= valor <= 2799:
        if orange == 0:
            minimo += 1
            coresLivres -= 1
        orange += 1
    elif 2800 <= valor <= 3199:
        if red == 0:
            minimo += 1
            coresLivres -= 1
        red += 1
    else:
        maximo += 1
 
if coresLivres == 8:
    print(1, maximo)

else:
    print(minimo, minimo+maximo)

Submission status: Accepted

Solution code:
Nc = input()
N = int(Nc)
c = map(int,input().split())
cor = ''
l = list(c)
l2 = []
maxL = 0
m = 0

for num in l:
    if 1 <= N <= 100 and 1 <= num <= 4800 and type(num) == int and len(l) == N:
        if  1 <= num <= 399:
            cor = 'cinzento'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 400 <= num <= 799:
            cor = 'a'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 800 <= num <= 1199:
            cor = 'b'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1200 <= num <= 1599:
            cor = 'c'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1600 <= num <= 1999:
            cor = 'd'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m +1
        elif 2000 <= num <= 2399:
            cor = 'e'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2400 <= num <= 2799:
            cor = 'f'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2800 <= num <= 3199:
            cor = 'g'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
        else:
            maxL = maxL + 1
            cor = 'escolha'
            if cor not in l2:
                l2.append(cor)
                m = m + 1
            
           
print(m, maxL)

Submission status: Accepted

Solution code:
Nc = input()
N = int(Nc)
c = map(int,input().split())
cor = ''
l = list(c)
l2 = []
maxL = 0
gambiarra = 0
m = 0

for num in l:
    if 1 <= N <= 100 and 1 <= num <= 4800 and type(num) == int and len(l) == N:
        if  1 <= num <= 399:
            cor = 'cinzento'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 400 <= num <= 799:
            cor = 'a'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 800 <= num <= 1199:
            cor = 'b'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1200 <= num <= 1599:
            cor = 'c'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1600 <= num <= 1999:
            cor = 'd'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m +1
        elif 2000 <= num <= 2399:
            cor = 'e'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2400 <= num <= 2799:
            cor = 'f'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2800 <= num <= 3199:
            cor = 'g'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
        elif 3199 <= num <= 4800:
            maxL = maxL + 1
            cor = 'escolha'
            if cor not in l2:
                l2.append(cor)
                m = m + 1
            
           
print(m, maxL)

Submission status: Accepted

Solution code:
Nc = input()
N = int(Nc)
c = map(int,input().split())
cor = ''
l = list(c)
l2 = []
maxL = 0
gambiarra = 0
m = 0

for num in l:
    if 1 <= N <= 100 and 1 <= num <= 4800 and type(num) == int and len(l) == N:
        if  1 <= num <= 399:
            cor = 'cinzento'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 400 <= num <= 799:
            cor = 'a'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 800 <= num <= 1199:
            cor = 'b'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1200 <= num <= 1599:
            cor = 'c'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1600 <= num <= 1999:
            cor = 'd'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m +1
        elif 2000 <= num <= 2399:
            cor = 'e'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2400 <= num <= 2799:
            cor = 'f'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2800 <= num <= 3199:
            cor = 'g'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
        elif 3199 <= num <= 4800:
            maxL = maxL + 1
            cor = 'escolha'
            if cor not in l2:
                l2.append(cor)
                m = m + 1
            else:
                l2.append(cor)
                gambiarra = gambiarra + 1
            
            
           
print(m, maxL)

Submission status: Accepted

Solution code:
def color_check(n):
    if n < 400:
        return "grey"
    elif n < 800:
        return "brown"
    elif n < 1200:
        return "green"
    elif n < 1600:
        return "cyan"
    elif n < 2000:
        return "blue"
    elif n < 2400:
        return "yellow"
    elif n < 2800:
        return "orange"
    elif n < 3200:
        return "red"
    else:
        return "any"

colors_so_far = set()
cany = 0
n = input()
c = map(int, input().split())

for i in c:
    color = color_check(i)
    if color != "any":
        colors_so_far.add(color)
    else:
        cany += 1

x = len(colors_so_far)
if x < 1:
    print(1, cany)
else:
    print(x, len(colors_so_far)+cany)