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:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


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

    sur=0
    b=[0 for _ in range(8)]
    for i in range(n):
        if a[i] // 400 >=8:
            sur += 1
        else:
            b[a[i]//400]=1

    eprint('b ',end=':\n')
    eprint(b)

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

    ans1=cnt + sur
    ans2=cnt
    print(max(ans2,1),ans1)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

check = [False] * 8
r = 0
for i in range(n):
    if a[i] < 400:
        check[0] = True
    elif 400 <= a[i] < 800:
        check[1] = True
    elif 800 <= a[i] < 1200:
        check[2] = True
    elif 1200 <= a[i] < 1600:
        check[3] = True
    elif 1600 <= a[i] < 2000:
        check[4] = True
    elif 2000 <= a[i] < 2400:
        check[5] = True
    elif 2400 <= a[i] < 2800:
        check[6] = True
    elif 2800 <= a[i] < 3200:
        check[7] = True
    else:
        r += 1

color = 0
ans_max = r
for i in range(8):
    if check[i]:
        color += 1
        ans_max += 1

ans_min = max(color,1)
print(ans_min,ans_max)

Submission status: Accepted

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

maximum = 0
minimum = 0
used = [0]*9
for i in A:
    i //= 400
    if i >= 8:
        maximum += 1
    elif used[i] == 0:
        maximum += 1
        minimum += 1
        used[i] = 1
if minimum == 0:
    minimum += 1
print(minimum, maximum)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
C = [0] * 9
for a in A:
    C[min(8, a//400)] += 1
s = sum([c > 0 for c in C[:-1]])
# print(C)
print(max(s, 1), s + C[-1])

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
ans = [0] * 8
over3200 = 0
rates = [1,400,800,1200,1600,2000,2400,2800,3200]
for i in range(N):
    if a[i] >= rates[8]:
        over3200 += 1
        continue
    for j in range(7,-1,-1):
        if a[i] >= rates[j]:
            ans[j] = 1
            break

min = 0
max = 0

if sum(ans) > 0:
    min = sum(ans)
else:
    min = 1

max = sum(ans) + over3200

print(min, max)

Submission status: Accepted

Solution code:
import collections
def solve(n, a_list):

    count = collections.Counter()
    for i in a_list:
        no = 8 if i // 400 >= 8 else i // 400
        count[no] += 1

    tmp = len([i for i in count.keys() if i != 8])
    max_value = tmp + count[8]
    min_value = 1 if tmp == 0 else tmp

    return "{0} {1}".format(min_value, max_value)

if __name__ == "__main__":
    n = int(input())
    a_list = [int(i) for i in input().split()]
    print(solve(n, a_list))

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
def main():
  n = int(input())
  A = readInts()
  LIST = set()
  d = 0
  
  for i in A:
    c = i // 400
    if c < 8:
      LIST.add(c)
    else:
      d+=1
  print(max(len(LIST),1),len(LIST)+d)
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
 
cnt1 = 0
for i in range(8):
  v1 = i * 400
  v2 = (i + 1) * 400 - 1
  for j in range(N):
    if v1 <= A[j] and A[j] <= v2:
      cnt1 += 1
      break
 
cnt2 = 0
for i in range(N):
  if A[i] >= 3200:
    cnt2 += 1
 
if cnt1 == 0:
  print(1, cnt2)
else:
  print(cnt1, cnt1 + cnt2)

Submission status: Accepted

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

color_n = [0 for i in range(9)]

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

print(max(8-color_n[:-1].count(0), 1),8-color_n[:-1].count(0)+color_n[-1])

Submission status: Accepted

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

if d['8'] == 0 :
  print(len(d)-1,len(d)-1)
else:
  if len(d)-1 == 0:
    print(1,len(d)+d['8'] -1)
  else:
    print(len(d)-1,len(d)+d['8'] -1)

Submission status: Accepted

Solution code:
tuplet=set()
count=0
input()
x=map(int,input().split())
for a in x:
    if a<400:
        tuplet.add("gr")
    elif a<800:
        tuplet.add("br")
    elif a<1200:
        tuplet.add("gre")
    elif a<1600:
        tuplet.add("wa")
    elif a<2000:
        tuplet.add("bl")
    elif a<2400:
        tuplet.add("ye")
    elif a<2800:
        tuplet.add("ore")
    elif a<3200:
        tuplet.add("red")
    else:
        count+=1
if count>0:
    ma=len(tuplet)+count
    mi=max(len(tuplet),1)
else:
    ma=len(tuplet)
    mi=ma
print("{} {}".format(mi,ma))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))
    colors = [0] * 8
    over = 0

    for a in A:
        if a < 3200:
            colors[a // 400] += 1
        else:
            over += 1

    result = sum(color > 0 for color in colors)

    if result:
        print(result, result + over)
    else:
        print(1, over)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
ARR = [int(s) for s in input().split(" ")]

def calculate(n, arr):
    dict = {'gray': False, 'brown': False, 'green': False, 'water': False, 'blue': False, 'yellow': False,
            'orange': False, 'red': False}
    any = 0

    for ar in arr:
        if ar >= 1 and ar <= 399:
            dict.__setitem__('gray',True)
        elif ar >= 400 and ar <= 799:
            dict.__setitem__('brown', True)
        elif ar >= 800 and ar <= 1199:
            dict.__setitem__('green', True)
        elif ar >= 1200 and ar <= 1599:
            dict.__setitem__('water', True)
        elif ar >= 1600 and ar <= 1999:
            dict.__setitem__('blue', True)
        elif ar >= 2000 and ar <= 2399:
            dict.__setitem__('yellow', True)
        elif ar >= 2400 and ar <= 2799:
            dict.__setitem__('orange', True)
        elif ar >= 2800 and ar <= 3199:
            dict.__setitem__('red', True)
        else:
            any = any + 1

    l = np.array(list(dict.values()))

    goodNum = np.sum(l == True)
    badNum = np.sum(l == False)

    if goodNum == 0:
        print(1,goodNum + any)
    else:
        print(goodNum,goodNum + any)

calculate(N,ARR)

Submission status: Accepted

Solution code:
#1問目
N = int(input())
A = list(map(int, input().split()))
color = [0,0,0,0,0,0,0,0]
overColor = 0
Min = 0
Max = 0

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

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

if(overColor == 0):
    print(str(count) + " " + str(count))
else:
    if(count == 0):
        print("1 " + str(overColor))
    else:
        print(str(count) + " " + str(count + overColor))

Submission status: Accepted

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

colors = [0]*9
for a in A:
    colors[min(8, a//400)] += 1
ansmin = 0
for c in colors[:-1]:
    if c:
        ansmin += 1
x = 0
if ansmin < colors[-1]:
    x = 1
print("{} {}".format(max(ansmin, x), ansmin+colors[-1]))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
B = [0]*9
for a in A:
    k = 0
    while a>=400*k:
        k+=1
        if k>8:break
    B[k-1]+=1
a = B[8]
B = [1 for b in B[:8] if b>0]
print(max(1,sum(B)),sum(B)+a)

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

#　素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# ここから書き始める
# Colorful Leaderboard 
n = int(input())
a = list(map(int, input().split()))
s = [0] * 8
cnt = 0
for i in a:
    if i < 3200:
        s[i // 400] = 1
    else:
        cnt += 1
# print(s)
maximum = sum(s) + cnt
minimum = max(sum(s), 1)
print(minimum, maximum)

# @lru_cache(maxsize=1000)
# def dfs(total, index):
#     if index == n:
#         if total % 10 != 0:
#             return total
#         return 0
#     return max(dfs(total + s[index], index + 1), dfs(total, index + 1))

# n = int(input())
# s = [0] * n
# for i in range(n):
#     s[i] = int(input())
# ans = dfs(0, 0)
# print(ans)

Submission status: Accepted

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

cnt1 = 0
for i in range(8):
  v1 = i * 400
  v2 = (i + 1) * 400 - 1
  for j in range(N):
    if v1 <= A[j] and A[j] <= v2:
      cnt1 += 1
      break

cnt2 = 0
for i in range(N):
  if A[i] >= 3200:
    cnt2 += 1

if cnt1 == 0:
  print(1, cnt2)
else:
  print(cnt1, cnt1 + cnt2)

Submission status: Accepted

Solution code:
from collections import Counter
from bisect import bisect_left

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

rate = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]

color = Counter()
for a in A:
    i = bisect_left(rate, a)
    color[i] += 1

# print(color) 399 799 1199 1599 1999 2399 2799 3199
L = len(list(color.keys()))
if color[8] > 0:
    print(max(L - 1, 1), L - 1 + color[8])
else:
    print(L, L)

Submission status: Accepted

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

ans = [0] * 9
for ai in a:
    if ai // 400 > 7:
        ans[8] += 1
    else:
        ans[ai // 400] = 1

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

Submission status: Accepted

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

color = [0]*9

for rate in a:
    if rate >= 3200:
        color[8] += 1
    else:
        color[rate//400] += 1
    
ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#1
#入力
N=int(input())
A=list(map(int,input().split()))

#処理

X=[0 for i in range(8)]
Y=0
for i in A:
    if i<400:
        X[0]=1
    elif i<800:
        X[1]=1
    elif i<1200:
        X[2]=1
    elif i<1600:
        X[3]=1
    elif i<2000:
        X[4]=1
    elif i<2400:
        X[5]=1
    elif i<2800:
        X[6]=1
    elif i<3200:
        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:
N = int(input())
a = list(map(int, input().split()))
li = [0] * 8
ans = 0
cnt = 0
for x in a:
    if x // 400 < 8:
        li[x//400] += 1
    else:
        cnt += 1
for i in range(8):
    if li[i] > 0:
        ans += 1

r = [max(1,ans), ans+cnt]
print(*r)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,(input().split())))
r = []
c = 0
for i in range(N):
    if a[i] >= 3200:
        c += 1
    else:
        r.append(a[i]//400)

nim = len(set(r))
ansm = max(1,nim)
ansM = nim + c
print(ansm,ansM)

Submission status: Accepted

Solution code:
import numpy as np
n=int(input())
a=list(map(int,input().split()))
a=np.array(a)
a=a//400
a1=[i for i in a if i<8]
a2=[i for i in a if i>=8]
k=len(set(a1))
m=k+len(a2)
#>8:m=8 else:m=k+len(a2)
if len(set(a1))!=0:s=len(set(a1))
else:s=1
print(s,m)

Submission status: Accepted

Solution code:
def solve(a):
 
    colors = [0]*9
 
    for i in a:
        num = 0
        tmp = 400
        flag = True
        for j in range(9):
            if i < 0:
                flag = False
                break
            else:
                i -= 400
                num += 1
        if flag:
            colors[num-1] += 1
        else:
            colors[num-1] = 1
    if sum(colors[:8]) == 0:
        print(1,colors[-1])
    else:
        print(sum(colors[:8]),sum(colors[:8])+colors[-1])
 
def main():
    N = int(input())
    a = list(map(int,input().split()))
    solve(a)
 
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

under_3200_cnt = {}
over_3200_cnt = 0
for score in scores:
    key = score // 400
    if key >= 8:
        over_3200_cnt += 1
    else :
        under_3200_cnt.setdefault(key, 0)
        under_3200_cnt[key] += 1
        
colors = len(under_3200_cnt.keys())

if over_3200_cnt == 0:
    min_color = colors
    max_color = colors
else :
    if colors >= 1:
        min_color = colors
    else :
        min_color = 1
    max_color = colors + over_3200_cnt
    
print(min_color, max_color)

Submission status: Accepted

Solution code:
import sys
n = int(input())
a = list(map(int, input().split()))
b = []
count = 0
for i in range (len(a)):
    if (a[i] < 3200):
        b.append(a[i]//400)
    else:
        count += 1
if (len(b)==0):
    print(*[1,count])
    sys.exit()
b_set = set(b)
ans = [len(b_set),len(b_set)+count]
print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A.sort()
flags = [False] * 8
min_ans = 1
high_coder = 0
for i in range(N):
    idx = A[i] // 400
    if idx < 8:
        flags[idx] = True
        min_ans = sum(flags)
    else:
        high_coder = N - i
        break

print(min_ans, sum(flags) + high_coder)

Submission status: Accepted

Solution code:
# input = sys.stdin.readline

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

    cnt = [False] * 8
    tuyo = 0
    for i in range(N):
        if 1 <= A[i] <= 3199:
            cnt[A[i] // 400] = True
        else:
            tuyo += 1

    val = 0
    for i in cnt:
        if i:
            val += 1
    if val==0 and tuyo>0:
        print(1,tuyo)
    else:
        print(val, val + tuyo)


resolve()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = list(map(int,input().split()))
    ary = [0] * 8
    tmp = 0
    for i, aa in enumerate(a):
        if 0 < aa <= 399 and ary[0] == 0:
            ary[0] = 1
        elif 399 < aa <= 799 and ary[1] == 0:
            ary[1] = 1
        elif 799 < aa <= 1199 and ary[2] == 0:
            ary[2] = 1
        elif 1199 < aa <= 1599 and ary[3] == 0:
            ary[3] = 1
        elif 1599 < aa <= 1999 and ary[4] == 0:
            ary[4] = 1
        elif 1999 < aa <= 2399 and ary[5] == 0:
            ary[5] = 1
        elif 2399 < aa <= 2799 and ary[6] == 0:
            ary[6] = 1
        elif 2799 < aa <= 3199 and ary[7] == 0:
            ary[7] = 1
        elif 3199 < aa:
            tmp += 1
            # print(a[i])
    if sum(ary) == 0:
        print(1,tmp)
    else:
        print(sum(ary), sum(ary) + tmp)

if __name__ =='__main__':
    main()

Submission status: Accepted

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

def flag(l,r):
    return 1 if [a for a in A if l <= a <= r] else 0

ans = 0
for l in range(0,2801, 400):
    ans += flag(l, l + 399)

ans1 = ans + len([a for a in A if a >= 3200])
if ans == 0:
    print(1,ans1)
else:
    print(ans,ans1)

Submission status: Accepted

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

cnt = [0]*8
ziyu = 0
for a in A:
    if 1 <= a <= 399 and cnt[0] == 0:
        cnt[0] = 1
    elif 400 <= a <= 799 and cnt[1] == 0:
        cnt[1] = 1
    elif 800 <= a < 1199 and cnt[2] == 0:
        cnt[2] = 1
    elif 1200 <= a <= 1599 and cnt[3] == 0:
        cnt[3] = 1
    elif 1600 <= a <= 1999 and cnt[4] == 0:
        cnt[4] = 1
    elif 2000 <= a <= 2399 and cnt[5] == 0:
        cnt[5] = 1
    elif 2400 <= a <= 2799 and cnt[6] == 0:
        cnt[6] = 1
    elif 2800 <= a <= 3199 and cnt[7] == 0:
        cnt[7] = 1
    elif a >= 3200:
        ziyu += 1

min_cnt = 0
if ziyu > 0:
    min_cnt = 1

print(max(min_cnt, sum(cnt)), sum(cnt)+ziyu)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
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
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

n = INT()
a = LIST()
arr = []
plus = 0
for i in range(n):
    flag = True
    for j in range(1, 9):
        if (j - 1) * 400 <= a[i] < j * 400:
            if not j in arr:
                arr.append(j)
            flag = False
    if flag:
        plus += 1
debug(len(arr), plus, arr)
ansmx = len(arr) + plus
ansmn = max(1, len(arr))
print(ansmn, ansmx)

Submission status: Accepted

Solution code:
n = int(input())
col = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
a = list(map(int,input().split()))
col_set = set()
cnt = 0
for i in range(n):
    if a[i] >= 3200:
        cnt += 1
    for j in range(len(col)):
        if a[i] <= col[j]:
            col_set.add(j)
            break
print(max(len(col_set), 1), len(col_set)+cnt)

Submission status: Accepted

Solution code:
N = int(input())
an = list(map(int, input().split()))
over_cnt = 0
colors = []
for a in an:
    rate = a // 400
    if rate >= 8:
        over_cnt += 1
    elif rate not in colors:
        colors.append(rate)
 
print(max(len(colors), 1), len(colors) + over_cnt)

Submission status: Accepted

Solution code:
def main():
    _ = int(input())
    a = list(map(int,input().split()))
    l = [0] * 9
    for v in a :
        if v//400 >=8:
            l[-1] +=1
        else:
            l[v//400] += 1
    cnt = 0
    for i in range(len(l)-1):
        if l[i] != 0: cnt+=1

    mx = cnt + l[-1]
    mn = cnt if cnt != 0 else 1 if l[-1] != 0 else 0
    print("{} {}".format(str(mn),str(mx)))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

color = []
another = 0
for i in range(N):
  if a[i] <= 399: color.append("gray")
  elif a[i] <= 799: color.append("brown")
  elif a[i] <= 1199: color.append("green")
  elif a[i] <= 1599: color.append("wblue")
  elif a[i] <= 1999: color.append("blue")
  elif a[i] <= 2399: color.append("yellow")
  elif a[i] <= 2799: color.append("orange")
  elif a[i] <= 3199: color.append("red")
  else: another +=1
color = list(set(color))
ans = len(color)
if ans == 0 and another > 0:
  ans = 1
print(ans, len(color) + another)

Submission status: Accepted

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

print(sum(c[:8])+(1 if c[8] and sum(c[:8])==0 else 0),sum(c[:8])+c[8])

Submission status: Accepted

Solution code:
N=int(input())
*A,=map(int, input().split())
col = [0]*8
free=0
for a in A:
    for i in range(8):
        if 400*i <= a < 400*(i+1): col[i] = 1
    if a >= 3200: free+=1

print(1 if sum(col) == 0 and free else sum(col), sum(col)+free)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    cnt = [0]*9
    for a in A:
        idx = min(a//400, 8)
        cnt[idx] += 1
    ans = sum(int(a > 0) for a in cnt[:-1])
    if ans != 0:
        print(ans, ans+cnt[-1])
    else:
        print(1, cnt[-1])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=[0,0,0,0,0,0,0,0]
free=int(0)
for i in range(n):
    if A[i]>=3200:
        free+=1
    else:
        now=int(A[i]/400)
        B[now]+=1
s=B.count(0)
s=8-s
if s==0:
    s=1
    free-=1
print("{} {}".format(s,s+free))

Submission status: Accepted

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

ans = set()
cnt = 0
for a in A:
    if a >= 3200:
        cnt += 1
    else:
        ans.add(a // 400)

mx = len(ans) + cnt
mi = max(1, len(ans))

print(mi, mx)

Submission status: Accepted

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    Rate = [0] * 9
    N = int(input())
    A = [int(a) for a in input().split()]
    for a in A: Rate[min(8, a // 400)] += 1
    count = 0
    for i in range(8):
        if Rate[i] > 0: count += 1
    minC, maxC = count, count + Rate[8]
    if count == 0: minC = 1
    print(minC, maxC)

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
cs = [0]*9
for a in A:
    if a >= 3200:
        cs[8] += 1
    else:
        cs[a//400] += 1

fixed = 0
for i in range(8):
    if cs[i]: fixed += 1

if fixed:
    print(fixed, fixed + cs[8])
else:
    print(1, cs[8])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = 0
color = set()
for i in range(n):
    if a[i]<400:
        color.add("a")
    elif a[i]<800:
        color.add("b")
    elif a[i]<1200:
        color.add("c")
    elif a[i]<1600:
        color.add("d")
    elif a[i]<2000:
        color.add("e")
    elif a[i]<2400:
        color.add("f")
    elif a[i]<2800:
        color.add("g")
    elif a[i]<3200:
        color.add("h")
    else:
        count += 1
if len(color) == 0:
    print(1, count)
else:
    print(len(color), len(color)+count)

Submission status: Accepted

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

rt=[0]*8
rt8=0
for i in range(n):
    for j in range(0,8):
        if 400*j<=a[i] and a[i]<=399+400*j:
            rt[j]=1
    if a[i]>=3200:
        rt8=rt8+1
        
rtmin=max(1,sum(rt))
#rtmax=min(rtmin+rt8,8)
rtmax=sum(rt)+rt8

print(rtmin,rtmax)

Submission status: Accepted

Solution code:
n = int(input())
lst = list(map(int, input().split()))
count = {"gray":0,"brown":0,"green":0,"lightblue":0,"blue":0,"yellow":0,"orange":0,"red":0}
free = 0

for i in lst:
    if i<400:
        count["gray"]+=1
    elif i<800:
        count["brown"]+=1
    elif i<1200:
        count["green"]+=1
    elif i<1600:
        count["lightblue"]+=1
    elif i<2000:
        count["blue"]+=1
    elif i<2400:
        count["yellow"]+=1
    elif i<2800:
        count["orange"]+=1
    elif i<3200:
        count["red"]+=1
    else:
        free+=1

ans = 0
for i in count.values():
    if i!=0:
        ans+=1

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
color = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 4800]
num = [0]*9
for i in a:
    for j in range(9):
        if i<=color[j]:
            num[j]+=1
            break
s = [1 for i in num[:8] if i>0]
print(max(sum(s), 1), sum(s)+num[8])