Problem:


Score : 300 points

Problem Statement

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

Rating 1-399 : gray

Rating 400-799 : brown

Rating 800-1199 : green

Rating 1200-1599 : cyan

Rating 1600-1999 : blue

Rating 2000-2399 : yellow

Rating 2400-2799 : orange

Rating 2800-3199 : red

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

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

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

Constraints

1 ≤ N ≤ 100

1 ≤ a_i ≤ 4800

a_i is an integer.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

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

Sample Input 1

4
2100 2500 2700 2700

Sample Output 1

2 2

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

Sample Input 2

5
1100 1900 2800 3200 3200

Sample Output 2

3 5

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

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

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

Sample Input 3

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

Sample Output 3

1 1

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



Sample input:
4
2100 2500 2700 2700


Sample output:
2 2

Submission status: Accepted

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

#%%
hai = 0
cha = 0
midori = 0
mizu = 0
ao = 0
ki = 0
dai = 0
aka = 0
above = 0
for a in A:
    if 1 <= a <= 399:
        hai = 1
    elif 400 <= a <= 799:
        cha = 1
    elif 800 <= a <= 1199:
        midori = 1
    elif 1200 <= a <= 1599:
        mizu = 1
    elif 1600 <= a <= 1999:
        ao = 1
    elif 2000 <= a <= 2399:
        ki = 1
    elif 2400 <= a <= 2799:
        dai = 1
    elif 2800 <= a <= 3199:
        aka = 1
    else:
        above += 1

n_rate = 8
total = hai + cha + midori + mizu + ao + ki + dai + aka

if total != 0:
    ans_min = total
else:
    ans_min = 1

ans_max = total+above

print(ans_min, ans_max)

Submission status: Accepted

Solution code:
n = int(input())
lst = list(map(int, input().split()))
rate = [400 * i for i in range(9)]
st = set()
rainbow = 0
for i in range(n):
  for j in range(8):
    if rate[j] <= lst[i] < rate[j + 1]:
      st.add(rate[j])
  if lst[i] >= 3200:
    rainbow += 1
if rainbow == n:
  print(1, n)
  exit()
print(len(st), len(st) + rainbow)

Submission status: Accepted

Solution code:
n, *aa = map(int, open(0).read().split())

ranks = [a//400 for a in aa]

optional = [a for a in ranks if a>7]

ordinal = {a for a in ranks if a<=7}

print(max(1, len(ordinal)), len(ordinal)+len(optional))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
l=[i//400 for i in a if i<3200]
c=len(set(l))
print(max(1,c),c+n-len(l))

Submission status: Accepted

Solution code:
n,*l=map(int,open(0).read().split())
c=[0]*13
for i in l: c[i//400]+=1
a=8-c[:8].count(0)
print(max(1,a),a+sum(c[8:]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*l=map(int,open(0).read().split())
s,c=set(),0
for i in l:
  if i<3200: s|={i//400}
  else: c+=1
print(max(1,len(s)),len(s)+c)

Submission status: Accepted

Solution code:
N = int(input())
lank = [0, 0, 0, 0, 0, 0, 0, 0]
a = list(map(int, input().split()))
cnt = 0

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

number_min = max(1, lank.count(1))
number_max = lank.count(1) + cnt

print(number_min, number_max)

Submission status: Accepted

Solution code:
n,*l=map(int,open(0).read().split())
c=[0]*13
for i in l: c[i//400]+=1
a=sum(i>0 for i in c[:8])
print(max(1,a),a+sum(c[8:]))

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    a = LI()

    color = [0] * 9
    for i in a:
        if 0 <= i < 400:
            color[0] += 1
        elif 400 <= i < 800:
            color[1] += 1
        elif 800 <= i < 1200:
            color[2] += 1
        elif 1200 <= i < 1600:
            color[3] += 1
        elif 1600 <= i < 2000:
            color[4] += 1
        elif 2000 <= i < 2400:
            color[5] += 1
        elif 2400 <= i < 2800:
            color[6] += 1
        elif 2800 <= i < 3200:
            color[7] += 1
        else:
            color[8] += 1
    
    ans_min = len([i for i in color[:8] if i > 0]) 
    if ans_min == 0:
        print(1, color[8])
    else:
        print(ans_min, ans_min + color[8])

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

color_set = set()
color_free_num = 0
for a_i in a:
    if a_i >= 3200:
        color_free_num += 1
    else:
        color_set.add(a_i // 400)

ans_min = max(len(color_set), 1)
ans_max = len(color_set) + color_free_num
ans = "{} {}".format(ans_min, ans_max)
print(ans)

Submission status: Accepted

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

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

def rank(n):
    if 1 <= n <= 399:
        return 'gray'
    elif 400 <= n <= 799:
        return 'brown'
    elif 800 <= n <= 1199:
        return 'green'
    elif 1200 <= n <= 1599:
        return 'skyblue'
    elif 1600 <= n <= 1999:
        return 'blue'
    elif 2000 <= n <= 2399:
        return 'yellow'
    elif 2400 <= n <= 2799:
        return 'orange'
    elif 2800 <= n <= 3199:
        return 'red'
    else:
        return 'others'

colors = [rank(a[i]) for i in range(n)]
numother = colors.count('others')
colors = set(colors)

if 'others' in colors:
    colors.remove('others')
    minimum = len(colors)
    tmp = minimum
    if minimum == 0:
        minimum = 1 
    maximum = tmp + numother
else:
    minimum = len(colors)
    maximum = minimum

print(minimum, maximum)

Submission status: Accepted

Solution code:
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

def f(rate):
    global zero
    color = [400,800,1200,1600,2000,2400,2800,3200]
    for i in range(8):
        if rate < color[i]:
            return i
if __name__ == "__main__":
    cnt = [0,0,0,0,0,0,0,0]
    n = I()
    a = Intl()
    zero = 0
    ans = 0
    for i in a:
        if i < 3200:cnt[f(i)] = 1
        else:zero += 1
    #print(cnt)
    print(max(1,sum(cnt)),sum(cnt)+zero)

Submission status: Accepted

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

rate = set()
free = 0
for a in A:
    if a < 3200:
        rate.add(a // 400)
    else:
        free += 1

if len(rate) == 0:
    color_min, color_max = 1, n
else:
    color_min, color_max = len(rate), len(rate) + free

print(color_min, color_max)

Submission status: Accepted

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

CO = [0] * 8
o32 = 0
for a in A:
    if a >= 3200:
        o32 += 1
        continue
    for i in range(8):
        if 4*i*100 <= a < 4*(i+1)*100: 
            CO[i] += 1
ans = 0
for count in CO:
    if count > 0:
        ans += 1
print(1 if ans==0 else ans, ans+o32)

Submission status: Accepted

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

if c != 0 and not 1 in R:
    mi = 1
else:
    mi = R.count(1)
ma = R.count(1) + c

print(mi, ma)

Submission status: Accepted

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

color = [0]*8
cnt = 0
free = 0

for x in a:
    tmp = x // 400
    if tmp >= 8:
        free += 1
        continue
    if color[tmp] == 0:
        color[tmp] = 1
        cnt += 1

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

Submission status: Accepted

Solution code:
import bisect

n = int(input())
a = list(map(int,input().split()))
a.sort()
sect = 0
col = 0
for i in range(400,3201,400):
    nsect = bisect.bisect_left(a,i)
    if nsect>sect:
        sect = nsect
        col += 1
print(max(col,1),col+n-nsect)

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
a = [min(8, int(x) // 400) for x in input().split()]
cnt = Counter(a)

min_col = 0     # レート3200未満の人の色の数
for i in range(8):
    if cnt[i]:
        min_col += 1

if min_col == 0:  # 全員3200以上
    min_col = 1
    max_col = N
else:
    max_col = min_col + cnt[8]

print(min_col, max_col)

Submission status: Accepted

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

Submission status: Accepted

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

flag = [False]*8
t = 0
for i in a:
  if i < 400: flag[0] = True
  elif i < 800: flag[1] = True
  elif i < 1200: flag[2] = True
  elif i < 1600: flag[3] = True
  elif i < 2000: flag[4] = True
  elif i < 2400: flag[5] = True
  elif i < 2800: flag[6] = True
  elif i < 3200: flag[7] = True
  elif 3200 <= i: t += 1
    
minNum = 0
p = flag.count(True)
if p > 0: minNum = p
elif p == 0 and t > 0:
  minNum = 1
  
maxNum = p + t

print(minNum,maxNum)

Submission status: Accepted

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

rate = [0 for _ in range(9)]
#print(rate)
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
  else:
    rate[8]+=1
    
#print(rate)

ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n = readInt()
a = readInts()
rate = [0]*9


for i in a:
  rate[min(i//400,8)]+=1
base = 8-rate[:-1].count(0)
ma = base+rate[-1]
print(max(base,1),ma)

Submission status: Accepted

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

for r in a:
  x=r//400
  if x>8:
    x=8
  c[x]+=1
ans=0
for i in range(9):
  if i==8:
    if ans==0:
      mn=1
      mx=n
    else:
      mn=ans
      mx=ans+c[i]
  if c[i]!=0:
    ans+=1

print("{} {}".format(mn,mx))

Submission status: Accepted

Solution code:
def Judge_the_color(P):
    if P <= 399:
        return 'gray'
    elif P<=799:
        return 'brown'
    elif P<=1199:
        return 'green'
    elif P<=1599:
        return 'lightblue'
    elif P<=1999:
        return 'blue'
    elif P<=2399:
        return 'yellow'
    elif P<=2799:
        return 'orange'
    elif P<=3199:
        return 'red'
    else:
        return 'WC'

N=int(input())
aaa=list(map(int,input().split()))
l=[]

for a in aaa:
    l.append(Judge_the_color(a))

WCs=l.count('WC')

MIN=len(set(l))
MAX=len(set(l))

if MIN==1 and l[0]=='WC':
    MIN=1
elif WCs>=1:
    MIN=MIN-1
else:
    pass

if WCs>=1:
    MAX=MAX-1+WCs
else:
    pass

print(MIN,MAX)

Submission status: Accepted

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

    color = [False] * 8
    over = False
    cnt_anycolor = 0

    for i in a:
        if i <= 399:
            color[0] = True
        elif i <= 799:
            color[1] = True
        elif i <= 1199:
            color[2] = True
        elif i <= 1599:
            color[3] = True
        elif i <= 1999:
            color[4] = True
        elif i <= 2399:
            color[5] = True
        elif i <= 2799:
            color[6] = True
        elif i <= 3199:
            color[7] = True
        else:
            over = True
            cnt_anycolor += 1

    min_color = 0
    max_color = 0

    for c in color:
        if c:
            min_color += 1
            max_color += 1

    if over:
        if min_color == 0:
            min_color += 1
        max_color += cnt_anycolor

    print(min_color, max_color)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

t = set()
c = 0
for i in range(n):
    if a[i] <= 399:
        t.add(1)
    elif a[i] <= 799:
        t.add(2)
    elif a[i] <= 1199:
        t.add(3)
    elif a[i] <= 1599:
        t.add(4)
    elif a[i] <= 1999:
        t.add(5)
    elif a[i] <= 2399:
        t.add(6)
    elif a[i] <= 2799:
        t.add(7)
    elif a[i] <= 3199:
        t.add(8)
    else:
        c += 1
s = len(t)
if c == 0:
    print(s,s)
else:
    if s == 0:
        print(1,c)
        exit()
    print(s,s+c)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
color_val=0
bigList=[]
for i in range(1,400):
  if i in a:
    color_val+=1
    break
for s in range(400,800):
  if s in a:
    color_val+=1
    break
for t in range(800,1200):
  if t in a:
    color_val+=1
    break
for u in range(1200,1600):
  if u in a:
    color_val+=1
    break
for q in range(1600,2000):
  if q in a:
    color_val+=1
    break
for e in range(2000,2400):
  if e in a:
    color_val+=1
    break
for f in range(2400,2800):
  if f in a:
    color_val+=1
    break
for g in range(2800,3200):
  if g in a:
    color_val+=1
    break
for z in a:
  if z >=3200:
    bigList.append(z)
    
max=color_val+len(bigList)
if color_val!=0:
  print(color_val,max)
else:
  print(1,max)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(x) for x in input().split() if int(x) < 3200]
c = len(set([x // 400 for x in a]))
print(max(c, 1), c + n - len(a))

Submission status: Accepted

Solution code:
_ = input()
a = [int(x) for x in input().split()]

p = set()
q = 0
for i in a:
    if i < 3200:
        p.add(i//400)
    else:
        q += 1
else:
    lenp = len(p)
    print(max(lenp, 1), lenp + q)

Submission status: Accepted

Solution code:
_ = input()
a = [int(x) for x in input().split()]

p = [False] * 8
q = 0
for i in a:
    if 3199 < i:
        q += 1
    else:
        for j in range(8):
            if 400 * j <= i < 400 * (j + 1):
                p[j] = True
else:
    s = sum(p)
    print(max(s, 1), s + q)

Submission status: Accepted

Solution code:
import collections

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


def color(rate):
    if 1 <= rate <= 399:
        return 'gray'
    elif 400 <= rate <= 799:
        return 'brown'
    elif 800 <= rate <= 1199:
        return 'green'
    elif 1200 <= rate <= 1599:
        return 'water'
    elif 1600 <= rate <= 1999:
        return 'blue'
    elif 2000 <= rate <= 2399:
        return 'yellow'
    elif 2400 <= rate <= 2799:
        return 'orange'
    elif 2800 <= rate <= 3199:
        return 'red'
    elif 3200 <= rate:
        return 'multi'


MAX_COLORS = 8

l = [color(rate) for rate in a]
c = collections.Counter(l)


k_not_multi = len([k for k in c.keys() if k != 'multi'])
multis = c['multi']

_max = multis + k_not_multi

if k_not_multi == 0:
    _min = 1
else:
    _min = k_not_multi
    # print(k_not_multi)
    #
    # _max = min(k_not_multi + c['multi'], MAX_COLORS)
    #
    # if k_not_multi == 0:
    #     _min = 1
    # else:
    #     _min = k_not_multi
# else:
#     _max = _min = len([k for k in c.keys()])

print(_min, _max)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
S=set()
cnt=0
for i in A:
  if i>=3200:
    cnt+=1
  else:
    S.add(i//400)
if len(S)==0:
  low=1
  high=cnt
else:
  low=len(S)
  high=cnt+low
print(low,high)

Submission status: Accepted

Solution code:
def main():
    is_exist = [False] * 8
    free = 0
    n = int(input())
    A = list(map(int, (input().split())))
    for a in A:
        color = a // 400
        if color >= 8:
            free += 1
        else:
            is_exist[color] = True

    normal_colors = sum(is_exist)
    minimum = normal_colors
    if not minimum and free:
        minimum = 1

    maximum = free + normal_colors
    print(minimum, maximum)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = []
C = 0
for i in range(N):
  if A[i]//400 < 8:
    B.append(A[i]//400)
  else:
    C += 1
b = set(B)
if len(b) == 0:
  print(1, C)
else:
  print(len(b), len(b)+C)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
l = [0, 0, 0, 0, 0, 0, 0, 0]
pro = 0
m1 = 0
m2 = 0

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

if l != [0, 0, 0, 0, 0, 0, 0, 0]:
    for i in l:
        if i != 0:
            m1 += 1
    m2 = m1 + pro
else:
    m1 = 1
    m2 = pro


print(m1, m2)

Submission status: Accepted

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

col = [0 for _ in range(9)]
for a in A:
  if a >= 3200:
    col[8] += 1
    continue
  col[a//400] = 1
  
ans_min = sum(col[:-1])
if ans_min == 0 and col[-1] != 0:
  ans_min = 1
print(ans_min, sum(col))

Submission status: Accepted

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

    ll = [0] * 9
    for aa in a:
        if 3200 <= aa:
            ll[0] += 1
            continue
        for i in range(1,9):
            if aa < 400 * i:
                ll[i] += 1
                break
    mn = sum([i > 0 for i in ll[1:]])
    mx = mn + ll[0]
    mn = max(int(ll[0] > 0), mn)

    print(mn, mx)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
l = [x//400 if x//400 <= 7 else 8 for x in a]
p = [0]*8
for i in l:
    if i < 8:
        p[i] = 1
pmin = sum(p) if sum(p) != 0 else 1
pmax = sum(p) + l.count(8)
print(pmin, pmax)

Submission status: Accepted

Solution code:
n = int(input())

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

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

minsum = 0
maxsum = 0

for i in range(8):
    if b[i] > 0:
        minsum += 1

maxsum = minsum
maxsum += b[8]

if minsum == 0:
    minsum = 1

print("{} {}".format(minsum, maxsum))

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
A=[a for a in A if a<3200]
free=n-len(A)
A=set(map(lambda x: x//400,A))
print(max(1,len(A)),len(A)+free)

Submission status: Accepted

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

if cnt==0:
    cnt=1
print(str(cnt)+" "+str(ans_max))

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    a = LI()
    color = 8
    free = 0
    flag = [False]*color
    for ai in a:
        if ai >= 3200:
            free += 1
        else:
            flag[ai//400] = True
    color_min = max(1, sum(flag))
    color_max = sum(flag)+free
    print("{} {}".format(color_min, color_max))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

if sum(ls) == 0:
    print(1, l[8])
else:
    print(sum(ls), sum(l))

Submission status: Accepted

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

count=[min(i//400,8)for i in A]
c8=count.count(8)

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

Submission status: Accepted

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

x = [0]*8
god = 0
for a in A:
    for i in range(8):
        if a < 400*(i+1):
            x[i] = 1
            break
    else:
        god += 1

res = sum(x)
print(max(res, 1), res+god)

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
color=[0]*9
ac=0
for i in range(N):
    rate=min(a[i]//400,8)
    color[rate]+=1
for i in range(8):
    if color[i]>=1:
        ac+=1
min_ans=max(ac,1)
max_ans=ac+color[8]
print(min_ans,max_ans)

Submission status: Accepted

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

b=[0,0,0,0,0,0,0,0]
cnt=0

for i in range(n):
    if a[i]//400==0:
        b[0]+=1
    if a[i]//400==1:
        b[1]+=1
    if a[i]//400==2:
        b[2]+=1
    if a[i]//400==3:
        b[3]+=1
    if a[i]//400==4:
        b[4]+=1
    if a[i]//400==5:
        b[5]+=1
    if a[i]//400==6:
        b[6]+=1
    if a[i]//400==7:
        b[7]+=1
    if a[i]//400>=8:
        cnt+=1
if cnt>0:
    print(max(1,len(b)-b.count(0)),len(b)-b.count(0)+cnt)
else:
    print(len(b)-b.count(0),len(b)-b.count(0)+cnt)

Submission status: Accepted

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

cnt = [0 for i in range(8)]
count = 0

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

ans_min = sum(cnt)
ans_max = ans_min + count
if ans_min == 0:
    ans_min =1

print("{} {}".format(ans_min, ans_max))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
C = [a//400 for a in A if a<3200]
M = len(set(C))
print(max(1,M),M+N-len(C))

Submission status: Accepted

Solution code:
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(input())
a = readints()
# print(a)
tmp = []
for i in range(n):
    if 1 <= a[i] and a[i] <= 399:
        tmp.append('ha')
    if 400 <= a[i] and a[i] <= 799:
        tmp.append('cha')
    if 800 <= a[i] and a[i] <= 1199:
        tmp.append('mi')
    if 1200 <= a[i] and a[i] <= 1599:
        tmp.append('mizu')
    if 1600 <= a[i] and a[i] <= 1999:
        tmp.append('ao')
    if 2000 <= a[i] and a[i] <= 2399:
        tmp.append('ki')
    if 2400 <= a[i] and a[i] <= 2799:
        tmp.append('da')
    if 2800 <= a[i] and a[i] <= 3199:
        tmp.append('aka')
    if 3200 <= a[i]:
        tmp.append('nanndemo')
# print(tmp)
z = 0
for i in range(len(tmp)):
    if tmp[i] == 'nanndemo':
        z += 1
if z == len(tmp):
    print(1, len(tmp))
    exit()

cnt = 0
tmp2 = list(set(tmp))
for i in range(len(tmp2)):
    if tmp2[i] != 'nanndemo':
        cnt += 1
min_x = cnt
#print('min', min_x)
cnt2 = 0
for i in range(len(tmp)):
    if tmp[i] == 'nanndemo':
        cnt2 += 1
# print(cnt2)
if cnt2 == 0:
    max_x = len(set(tmp))
    print(min_x, max_x)
    exit()
cnt3 = 0
if cnt2 != 0:
    for i in range(len(tmp2)):
        if tmp2[i] != 'nanndemo':
            cnt3 += 1
max_xx = cnt3+cnt2
print(min_x, max_xx)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter


N = int(input())
a = Counter(map(lambda x: min(8, int(x) // 400), input().split()))
super_coders = a.pop(8, 0)
mn = len(a)
if mn == 0 and super_coders:
    mn = 1
mx = len(a) + super_coders
print(mn, mx)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
free = 0
color = set()
for i in range(N):
    if A[i]<3200:
        color.add(A[i]//400)
    else:
        free += 1
c = len(color)
if c>0:
    print(c,c+free)
else:
    print(1,free)

Submission status: Accepted

Solution code:
C = {i:0 for i in range(9)}
N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    a = A[i]
    if a<400:
        C[0] += 1
    elif a<800:
        C[1] += 1
    elif a<1200:
        C[2] += 1
    elif a<1600:
        C[3] += 1
    elif a<2000:
        C[4] += 1
    elif a<2400:
        C[5] += 1
    elif a<2800:
        C[6] += 1
    elif a<3200:
        C[7] += 1
    else:
        C[8] += 1
cmin = 0
for i in range(8):
    if C[i]>0:
        cmin += 1
if cmin==0:
    cmin = 1
    cmax = C[8]
else:
    cmax = cmin+C[8]
print(cmin,cmax)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = [0 for i in range(8)]
a = 0
for i in range(N):
  if A[i] < 400:
    B[0] = 1
  elif A[i] < 800:
    B[1] = 1
  elif A[i] < 1200:
    B[2] = 1
  elif A[i] < 1600:
    B[3] = 1
  elif A[i] < 2000:
    B[4] = 1
  elif A[i] < 2400:
    B[5] = 1
  elif A[i] < 2800:
    B[6] = 1
  elif A[i] < 3200:
    B[7] = 1
  else:
    a += 1
b = sum(B)
m = b
M = b + a
if b == 0:
  m = 1
print(m, M, sep=' ')

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
X = [0]*8
y = 0

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
a = list(map(int, input().split()))
cnt = [0]*9

for ai in a:
    i = min(ai//400, 8)
    cnt[i] += 1

m = 0
M = 0

for i in range(8):
    if cnt[i]>0:
        m += 1
        M += 1

if cnt[-1]>0:
    if m==0:
        m = 1
    
    M += cnt[-1]

print(m, M)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):a[i]=min(a[i],3200)//400
m=a.count(8)
s=set(a)
s.discard(8)
print(max(1,len(s)),len(s)+m)