Problem:


Score : 300 points

Problem Statement

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

Rating 1-399 : gray

Rating 400-799 : brown

Rating 800-1199 : green

Rating 1200-1599 : cyan

Rating 1600-1999 : blue

Rating 2000-2399 : yellow

Rating 2400-2799 : orange

Rating 2800-3199 : red

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

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

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

Constraints

1 ≤ N ≤ 100

1 ≤ a_i ≤ 4800

a_i is an integer.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

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

Sample Input 1

4
2100 2500 2700 2700

Sample Output 1

2 2

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

Sample Input 2

5
1100 1900 2800 3200 3200

Sample Output 2

3 5

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

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

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

Sample Input 3

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

Sample Output 3

1 1

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



Sample input:
4
2100 2500 2700 2700


Sample output:
2 2

Submission status: Wrong Answer

Solution code:

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

    for a in a_list:
        if a < 3200:
            rate_table[a//400] += 1
        else:
            over += 1
            
    mini = 0
    for r in rate_table:
        mini += 1 if r > 0 else 0

    maxi = min(mini + over, 8)
    
    if over > 0 and mini == 0:
        mini = 1
    print(mini, maxi)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:

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

    for a in a_list:
        if a < 3200:
            rate_table[a//400] += 1
        else:
            over += 1
    mini = 0
    for r in rate_table:
        mini += 1 if r > 0 else 0


    maxi = min(mini + over, 8)
    print(mini, maxi)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

print(sum(m), sum(color))

Submission status: Wrong Answer

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

print(sum(m), sum(color))

Submission status: Wrong Answer

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

print(sum(m), sum(color))

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
color = [0]*8
strong = 0

for i in range(N):
    if a[i] >= 3200:
        strong += 1
    else:
        if a[i] < 400:
            color[0] = 1
        elif a[i] < 800:
            color[1] = 1
        elif a[i] < 1200:
            color[2] = 1
        elif a[i] < 1600:
            color[3] = 1
        elif a[i] < 2000:
            color[4] = 1
        elif a[i] < 2400:
            color[5] = 1
        elif a[i] < 2800:
            color[6] = 1
        else:
            color[7] = 1

smallest = color.count(1)
greatest = smallest + strong

print(smallest, greatest)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
color = [0]*8
strong = 0

for i in range(N):
    if a[i] >= 3200:
        strong += 1
    else:
        if a[i] < 400:
            color[0] = 1
        elif a[i] < 800:
            color[1] = 1
        elif a[i] < 1200:
            color[2] = 1
        elif a[i] < 1600:
            color[3] = 1
        elif a[i] < 2000:
            color[4] = 1
        elif a[i] < 2400:
            color[5] = 1
        elif a[i] < 2800:
            color[6] = 1
        else:
            color[7] = 1

smallest = 8 - color.count(0)
greatest = smallest + strong
if greatest > 8:
    greatest = 8

print(smallest, greatest)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    a = list(map(int, input().split()))
      
    l = set()    
    free = 0
    for aa in a:
        if aa // 400 >= 8:
            free += 1
        else:
            l.add(aa // 400)
    print(len(l), len(l) + free)
        
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
a = sorted([i//400 for i in a])
min = 0
max = 0
flag = -1
for i in range(n):
  if a[i] >= 8:
    max += 1
  elif flag != a[i]:
    min += 1
    max += 1
  flag = a[i]
print(min,max)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
a = sorted([i//400 for i in a])
min = 0
max = 0
flag = -1
for i in range(n):
  if a[i] >= 8:
    max += 1
  elif flag != a[i]:
    min += 1
    max += 1
    flag = a[i]
print(min,max)

Submission status: Wrong Answer

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

silver = 0
rate = set([])
for a in A:
    if a >= 3200:
        silver += 1
    elif 2800 <= a <= 3199:
        rate.add("red")
    elif 2400 <= a <= 2799:
        rate.add("orange")
    elif 2000 <= a <= 2399:
        rate.add("yellow")
    elif 1600 <= a <= 1999:
        rate.add("blue")
    elif 1200 <= a <= 1599:
        rate.add("cyan")
    elif 800 <= a <= 1199:
        rate.add("green")
    elif 400 <= a <= 799:
        rate.add("brown")
    else:
        rate.add("hai")

print(len(rate), len(rate)+silver)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    ll=list(map(int,input().split()))
    l=[0]*9
    for i in ll:
        if i<400:
            l[0]+=1
        elif i<800:
            l[1]+=1
        elif i<1200:
            l[2]+=1
        elif i<1600:
            l[3]+=1
        elif i<2000:
            l[4]+=1
        elif i<2400:
            l[5]+=1
        elif i<2800:
            l[6]+=1
        elif i<3200:
            l[7]+=1
        else:
            l[8]+=1
    cnt=0
    for j in l[:8]:
        if j!=0:
            cnt+=1
    print(cnt,cnt+l[8])
resolve()

Submission status: Wrong Answer

Solution code:
n = int(input())
a_li = list(map(int,input().split()))
a_li.sort()
ans_min = [0]*8
ans_max = [0]*8
dum = 0
for i in a_li:
    if 0 < i < 400:
        ans_max[0] = 1
        ans_min[0] = 1
    elif 400 <= i < 800:
        ans_max[1] = 1
        ans_min[1] = 1
    elif 800 <= i < 1200:
        ans_max[2] = 1
        ans_min[2] = 1
    elif 1200 <= i < 1600:
        ans_max[3] = 1
        ans_min[3] = 1
    elif 1600 <= i < 2000:
        ans_max[4] = 1
        ans_min[4] = 1
    elif 2000 <= i < 2400:
        ans_max[5] = 1
        ans_min[5] = 1
    elif 2400 <= i < 2800:
        ans_max[6] = 1
        ans_min[6] = 1
    elif 2800 <= i < 3200:
        ans_max[7] = 1
        ans_min[7] = 1
    else:
        dum += 1
ans_max_sum = sum(ans_max) + dum
ans_min_sum = sum(ans_min)
if ans_min_sum == 0:
    ans_min_sum = 1
if ans_max_sum > 8:
    ans_max_sum = 8
print(ans_min_sum,ans_max_sum)

Submission status: Wrong Answer

Solution code:
n = int(input())
a_li = list(map(int,input().split()))
a_li.sort()
ans_min = [0]*8
ans_max = [0]*8
dum = 0
for i in a_li:
    if 0 < i < 400:
        ans_max[0] = 1
        ans_min[0] = 1
    elif 400 <= i < 800:
        ans_max[1] = 1
        ans_min[1] = 1
    elif 800 <= i < 1200:
        ans_max[2] = 1
        ans_min[2] = 1
    elif 1200 <= i < 1600:
        ans_max[3] = 1
        ans_min[3] = 1
    elif 1600 <= i < 2000:
        ans_max[4] = 1
        ans_min[4] = 1
    elif 2000 <= i < 2400:
        ans_max[5] = 1
        ans_min[5] = 1
    elif 2400 <= i < 2800:
        ans_max[6] = 1
        ans_min[6] = 1
    elif 2800 <= i < 3200:
        ans_max[7] = 1
        ans_min[7] = 1
    else:
        dum += 1
ans_max_sum = sum(ans_max) + dum
ans_min_sum = sum(ans_min)
if ans_max_sum > 8:
    ans_max_sum = 8
print(ans_min_sum,ans_max_sum)

Submission status: Wrong Answer

Solution code:
n = int(input())
a_li = list(map(int,input().split()))
a_li.sort()
ans_min = [0]*8
ans_max = [0]*8
dum = 0
for i in a_li:
    if 0 < i < 400:
        ans_max[0] = 1
        ans_min[0] = 1
    elif 400 <= i < 800:
        ans_max[1] = 1
        ans_min[1] = 1
    elif 800 <= i < 1200:
        ans_max[2] = 1
        ans_min[2] = 1
    elif 1200 <= i < 1600:
        ans_max[3] = 1
        ans_min[3] = 1
    elif 1600 <= i < 2000:
        ans_max[4] = 1
        ans_min[4] = 1
    elif 2000 <= i < 2400:
        ans_max[5] = 1
        ans_min[5] = 1
    elif 2400 <= i < 2800:
        ans_max[6] = 1
        ans_min[6] = 1
    elif 2800 <= i < 3200:
        ans_max[6] = 1
        ans_min[6] = 1
    else:
        dum += 1
ans_max_sum = sum(ans_max) + dum
ans_min_sum = sum(ans_min)
if ans_max_sum > 8:
    ans_max_sum = 8
print(ans_min_sum,ans_max_sum)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
ll = [0,400,800,1200,1600,2000,2400,2800,3200]
al = [0] * 9

ans = 0
cnt = 0

for i in range(n):
  for j in range(0,8):
    if l[i] >= 3200:
      cnt = +1
      break
    if ll[j] <= l[i] < ll[j+1]:
      al[j] = 1

if sum(al) != 0:
  print(sum(al), sum(al) + cnt)
else:
  print(1,cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
ll = [0,400,800,1200,1600,2000,2400,2800,3200]
al = [0] * 9

ans = 0
cnt = 0

for i in range(n):
  for j in range(0,8):
    if l[i] >= 3200:
      cnt = +1
      break
    if ll[j] <= l[i] < ll[j+1]:
      al[j] = 1
print(al,cnt)

if sum(al) != 0:
  print(sum(al), sum(al) + cnt)
else:
  print(1,cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
ll = [0,400,800,1200,1600,2000,2400,2800,3200]
al = [0] * 8

ans = 0
cnt = 0

for i in range(n):
  for j in range(0,8):
    if ll[j] <= l[i] < ll[j+1]:
      al[j] = 1
    if l[i] >= 3200:
      cnt += 1
      break
if sum(al) != 0:
  print(sum(al), sum(al) + cnt)
else:
  print(cnt,cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
ll = [0,400,800,1200,1600,2000,2400,2800,3200]
al = [0] * 8

ans = 0
cnt = 0

for i in range(n):
  for j in range(0,8):
    if ll[j] <= l[i] < ll[j+1]:
      al[j] = 1
    if l[i] >= 3200:
      cnt += 1
      break
if cnt != 0:
  print(sum(al), sum(al) + cnt)
else:
  print(sum(al) + cnt, sum(al) + cnt)

Submission status: Wrong Answer

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

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    color = [0] * 9
    n = ii()
    L = lmi()
    for num in L:
        if num >= 3200:
            color[8] += 1
        else:
            color[num // 400] += 1
    variety = 0
    for i in range(8):
        if color[i] > 0:
            variety += 1
    print("{} {}".format(variety, variety + color[8]))



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
ll = [0,400,800,1200,1600,2000,2400,2800,3200]
al = [0] * 8

ans = 0
cnt = 0

for i in range(n):
  for j in range(0,8):
    if ll[j] <= l[i] < ll[j+1]:
      al[j] = 1
    if l[i] >= 3200:
      cnt += 1
      break

print(sum(al), sum(al) + cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
ll = [0,400,800,1200,1600,2000,2400,2800,3200]
al = [0] * 8

ans = 0
cnt = 0

for i in range(n):
  for j in range(0,8):
    if ll[j] <= l[i] < ll[j+1]:
      al[j] = 1
    if l[i] >= 3200:
      cnt += 1
      break

print(sum(al), min(sum(al) + cnt,8))

Submission status: Wrong Answer

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

rate = {}
for i in range(9):
    rate[i] = 0

for i in range(N):
    a = A[i]
    if 1<=a and a<=399:
        rate[0] += 1
        continue
    if 400<=a and a<=799:
        rate[1] += 1
        continue
    if 800<=a and a<=1199:
        rate[2] += 1
        continue
    if 1200<=a and a<=1599:
        rate[3] += 1
        continue
    if 1600<=a and a<=1999:
        rate[4] += 1
        continue
    if 2000<=a and a<=2399:
        rate[5] += 1
        continue
    if 2400<=a and a<=2799:
        rate[6] += 1
        continue
    if 2800<=a and a<=3199:
        rate[7] += 1
        continue
    if 3200<=a:
        rate[8] += 1
        continue

ans_min = 0
ans_max = 0
count_zero = 0
count_3200over = rate[8]

for i in range(8):
    if rate[i]>=1:
        ans_min = ans_min + 1
    else:
        count_zero = count_zero + 1
ans_max = ans_min

if count_zero==8:
    if count_3200over>=1:
        print(1, min(count_3200over, 8))
        exit()
    else:
        print(0, 0)
        exit()
if count_zero<=count_3200over:
    print(ans_min, ans_max+count_zero)
else:
    print(ans_min, ans_max+count_3200over)

Submission status: Wrong Answer

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

rate = {}
for i in range(9):
    rate[i] = 0

for i in range(N):
    a = A[i]
    if 1<=a and a<=399:
        rate[0] += 1
        continue
    if 400<=a and a<=799:
        rate[1] += 1
        continue
    if 800<=a and a<=1199:
        rate[2] += 1
        continue
    if 1200<=a and a<=1599:
        rate[3] += 1
        continue
    if 1600<=a and a<=1999:
        rate[4] += 1
        continue
    if 2000<=a and a<=2399:
        rate[5] += 1
        continue
    if 2400<=a and a<=2799:
        rate[6] += 1
        continue
    if 2800<=a and a<=3199:
        rate[7] += 1
        continue
    if 3200<=a:
        rate[8] += 1
        continue

ans_min = 0
ans_max = 0
count_zero = 0
count_3200over = rate[8]

for i in range(8):
    if rate[i]>=1:
        ans_min = ans_min + 1
    else:
        count_zero = count_zero + 1
ans_max = ans_min

if count_zero==8:
    if count_3200over>=1:
        print(1, min(count_3200over, 8))
        exit()
    else:
        print(0, 0)
if count_zero<=count_3200over:
    print(ans_min, ans_max+count_zero)
else:
    print(ans_min, ans_max+count_3200over)

Submission status: Wrong Answer

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

rate = {}
for i in range(9):
    rate[i] = 0

for i in range(N):
    a = A[i]
    if 1<=a and a<=399:
        rate[0] += 1
        continue
    if 400<=a and a<=799:
        rate[1] += 1
        continue
    if 800<=a and a<=1199:
        rate[2] += 1
        continue
    if 1200<=a and a<=1599:
        rate[3] += 1
        continue
    if 1600<=a and a<=1999:
        rate[4] += 1
        continue
    if 2000<=a and a<=2399:
        rate[5] += 1
        continue
    if 2400<=a and a<=2799:
        rate[6] += 1
        continue
    if 2800<=a and a<=3199:
        rate[7] += 1
        continue
    if 3200<=a:
        rate[8] += 1
        continue

ans_min = 0
ans_max = 0
count_zero = 0
count_3200over = rate[8]

for i in range(8):
    if rate[i]>=1:
        ans_min = ans_min + 1
    else:
        count_zero = count_zero + 1
ans_max = ans_min

if count_zero==8:
    print(ans_min, ans_max)
    exit()

if count_zero<=count_3200over:
    print(ans_min, ans_max+count_zero)
else:
    print(ans_min, ans_max+count_3200over)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = [0 for _ in range(9)]
for i in list(map(int,input().split())):
    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

if sum(ans[:8]) != 0:
    print(sum(ans[:8]), min(sum(ans), 8))
else:
    print(1,min(sum(ans),8))

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = [0 for _ in range(9)]
for i in list(map(int,input().split())):
    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(sum(ans[:8]), min(sum(ans),8))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
color = [0]*9
for i in range(N):
  flag = 0
  for j in range(8):
    
    if 400*j <= A[i] <400*(j+1):
      color[j] += 1
      flag = 1
  if flag == 0:
    color[8] += 1
count = 0
for i in range(8):
    if color[i]>0:
        count += 1
if count ==0:
  a, b = 1, min(color[8], 8)
else:
  a, b =count, min(count+color[8], 8)
print(a, b)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
color = [0]*9
for i in range(N):
  flag = 0
  for j in range(8):
    
    if 400*j <= A[i] <400*(j+1):
      color[j] += 1
      flag = 1
  if flag == 0:
    color[8] += 1
count = 0
for i in range(8):
    if color[i]>0:
        count += 1
if not any(color[:8]):
  a, b = 1, min(color[8], 8)
else:
  a, b =count, min(count+color[8], 8)
print(a, b)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
color = [0]*9
for i in range(N):
  flag = 0
  for j in range(8):
    
    if 400*j <= A[i] <400*(j+1):
      color[j] += 1
      flag = 1
  if flag == 0:
    color[8] += 1
count = 0
for i in range(7):
    if color[i]>0:
        count += 1
if not any(color[:8]):
  a, b = 1, min(color[8], 8)
else:
  a, b =count, min(count+color[8], 8)
print(a, b)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
color = [0]*9
for i in range(N):
  flag = 0
  for j in range(8):
    
    if 400*j <= A[i] <400*(j+1):
      color[j] += 1
      flag = 1
  if flag == 0:
    color[8] += 1
if not any(color[:8]):
  a, b = 1, min(color[8], 8)
else:
  a, b =sum(color[:8]), min(sum(color[:8])+color[8], 8)
print(a, b)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
color = [0]*9
for i in range(N):
  flag = 0
  for j in range(8):
    
    if 400*j <= A[i] <400*(j+1):
      color[j] += 1
      flag = 1
  if flag == 0:
    color[8] += 1
if not any(color[:8]):
  a, b = 1, min(color[8], 8)
else:
  a, b =sum(color[:8]), min(sum(color[:8])+color[8], 8)

Submission status: Wrong Answer

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

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

large=sum(l)
small=sum(l)-l[8]

print(small, large)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int,input().split()))
count = 0
color = list()

for i in range(len(S)):
  if S[i] < 400:
    S[i] = "grey"
    
  elif S[i] < 800:
    S[i] = "blown"
    
  elif S[i] < 1200:
    S[i] = "green"
  
  elif S[i] < 1600:
    S[i] = "water"
    
  elif S[i] < 2000:
    S[i] = "blue"
  
  elif S[i] < 2400:
    S[i] = "yellow"
  
  elif S[i] < 2800:
    S[i] = "orange"
   
  elif S[i] < 3200:
    S[i] = "red"
    
  elif 3200 <= S[i]:
    S[i] = "wanwan"
    count += 1
  color.append(S[i])


color_set = set(color)
if count == 0:
  print(len(color_set),len(color_set))
else:
  print(len(color_set) -1,len(color_set) + count -1)

Submission status: Wrong Answer

Solution code:
from itertools import groupby

RANGE_TO_COLORS = {
    range(1, 400): "gray",
    range(400, 800): "brown",
    range(800, 1200): "green",
    range(1200, 1600): "lightblue",
    range(1600, 2000): "blue",
    range(2000, 2400): "yellow",
    range(2400, 2800): "orange",
    range(2800, 3200): "red",
    range(3200, 4800): "all"
}


def rate_to_color(r: int) -> str:
    for _range, color in RANGE_TO_COLORS.items():
        if r in _range:
            return color
    else:
        return "Unknown"


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

groups = []
unique_keys = []
data = sorted(A, key=rate_to_color)
for k, g in groupby(data, rate_to_color):
    groups.append(len(list(g)))
    unique_keys.append(k)

if "all" in unique_keys:
    idx = unique_keys.index("all")
    n = groups[idx]
    c = len(unique_keys) - 1
else:
    n = 0
    c = len(unique_keys)

print(c if c >= 1 else 1, n + c)

Submission status: Wrong Answer

Solution code:
from itertools import groupby

RANGE_TO_COLORS = {
    range(1, 400): "gray",
    range(400, 800): "brown",
    range(800, 1200): "green",
    range(1200, 1600): "lightblue",
    range(1600, 2000): "blue",
    range(2000, 2400): "yellow",
    range(2400, 2800): "orange",
    range(2800, 3200): "red",
    range(3200, 4800): "all"
}


def rate_to_color(r: int) -> str:
    for _range, color in RANGE_TO_COLORS.items():
        if r in _range:
            return color
    else:
        return "Unknown"


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

groups = []
unique_keys = []
data = sorted(A, key=rate_to_color)
for k, g in groupby(data, rate_to_color):
    groups.append(len(list(g)))
    unique_keys.append(k)

if "all" in unique_keys:
    idx = unique_keys.index("all")
    n = groups[idx]
    c = len(unique_keys) - 1
else:
    n = 0
    c = len(unique_keys)

print(n + c, c if c >= 1 else 1)

Submission status: Wrong Answer

Solution code:
from itertools import groupby

RANGE_TO_COLORS = {
    range(1, 400): "gray",
    range(400, 800): "brown",
    range(800, 1200): "green",
    range(1200, 1600): "lightblue",
    range(1600, 2000): "blue",
    range(2000, 2400): "yellow",
    range(2400, 2800): "orange",
    range(2800, 3200): "red",
    range(3200, 4800): "all"
}


def rate_to_color(r: int) -> str:
    for _range, color in RANGE_TO_COLORS.items():
        if r in _range:
            return color
    else:
        return "Unknown"


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

groups = []
unique_keys = []
data = sorted(A, key=rate_to_color)
for k, g in groupby(data, rate_to_color):
    groups.append(len(list(g)))
    unique_keys.append(k)


if "all" in unique_keys:
    idx = unique_keys.index("all")
    all_value = groups[idx]
    colors_exclude_all = len(unique_keys) - 1
    if colors_exclude_all >= 1:
        print(colors_exclude_all, colors_exclude_all + all_value)
    else:
        print(1, all_value)

else:
    print(len(unique_keys), len(unique_keys))

Submission status: Wrong Answer

Solution code:
from itertools import groupby

RANGE_TO_COLORS = {
    range(1, 400): "gray",
    range(400, 800): "brown",
    range(800, 1200): "green",
    range(1200, 1600): "lightblue",
    range(1600, 2000): "blue",
    range(2000, 2400): "yellow",
    range(2400, 2800): "orange",
    range(2800, 3200): "red",
    range(3200, 4800): "all"
}


def rate_to_color(r: int) -> str:
    for _range, color in RANGE_TO_COLORS.items():
        if r in _range:
            return color
    else:
        return "Unknown"


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

groups = []
unique_keys = []
data = sorted(A, key=rate_to_color)
for k, g in groupby(data, rate_to_color):
    groups.append(len(list(g)))
    unique_keys.append(k)


if "all" in unique_keys:
    idx = unique_keys.index("all")
    all_value = groups[idx]
    colors_exclude_all = len(unique_keys) - 1
    if colors_exclude_all > 0:
        print(colors_exclude_all, colors_exclude_all + all_value)
    else:
        print(1, all_value)

else:
    print(len(unique_keys), len(unique_keys))

Submission status: Wrong Answer

Solution code:
from itertools import groupby

RANGE_TO_COLORS = {
    range(1, 400): "gray",
    range(400, 800): "brown",
    range(800, 1200): "green",
    range(1200, 1600): "lightblue",
    range(1600, 2000): "blue",
    range(2000, 2400): "yellow",
    range(2400, 2800): "orange",
    range(2800, 3200): "red",
    range(3200, 4800): "all"
}


def rate_to_color(r: int) -> str:
    for _range, color in RANGE_TO_COLORS.items():
        if r in _range:
            return color
    else:
        return "Unknown"


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

groups = []
unique_keys = []
data = sorted(A, key=rate_to_color)
for k, g in groupby(data, rate_to_color):
    groups.append(len(list(g)))
    unique_keys.append(k)

if "all" in unique_keys:
    idx = unique_keys.index("all")
    all_value = groups[idx]
    colors_exclude_all = len(unique_keys) - 1
    if (colors_exclude_all - all_value) >= 0:
        print(colors_exclude_all, colors_exclude_all + all_value)
    else:
        print(colors_exclude_all + (all_value - colors_exclude_all), colors_exclude_all + all_value)

else:
    print(len(unique_keys), len(unique_keys))