output_description stringlengths 15 956 | submission_id stringlengths 10 10 | status stringclasses 3 values | problem_id stringlengths 6 6 | input_description stringlengths 9 2.55k | attempt stringlengths 1 13.7k | problem_description stringlengths 7 5.24k | samples stringlengths 2 2.72k |
|---|---|---|---|---|---|---|---|
Print the minimum number of new stones that Jiro needs to place for his
purpose.
* * * | s207493333 | Wrong Answer | p03945 | The input is given from Standard Input in the following format:
S | (lambda line: print(line.count("WB") + int(line.endswith("W"))))(input())
| Statement
Two foxes Jiro and Saburo are playing a game called _1D Reversi_. This game is
played on a board, using black and white stones. On the board, stones are
placed in a row, and each player places a new stone to either end of the row.
Similarly to the original game of Reversi, when a white stone is placed, all
black stones between the new white stone and another white stone, turn into
white stones, and vice versa.
In the middle of a game, something came up and Saburo has to leave the game.
The state of the board at this point is described by a string S. There are |S|
(the length of S) stones on the board, and each character in S represents the
color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in
S is `B`, it means that the color of the corresponding stone on the board is
black. Similarly, if the i-th character in S is `W`, it means that the color
of the corresponding stone is white.
Jiro wants all stones on the board to be of the same color. For this purpose,
he will place new stones on the board according to the rules. Find the minimum
number of new stones that he needs to place. | [{"input": "BBBWW", "output": "1\n \n\nBy placing a new black stone to the right end of the row of stones, all white\nstones will become black. Also, by placing a new white stone to the left end\nof the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\n* * *"}, {"input": "WWWWWW", "output": "0\n \n\nIf all stones are already of the same color, no new stone is necessary.\n\n* * *"}, {"input": "WBWBWBWBWB", "output": "9"}] |
Print the value A \times B as an integer.
* * * | s757725678 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | a, b = (int(i) for i in input().split())
print(f"{a * b}")
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s706390122 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | Num1, Num2 = map(int, input().split())
print(Num1 * Num2)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s643128441 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | inlist = input().split()
print(inlist[0] * inlist[1])
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s708294578 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | number = list(map(float, input().split()))
print("{}".format(round(int(number[0]) * number[1])))
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s986119819 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | sute = input()
input_nums = input().split()
output = 1
x = map((lambda x: int(x)), input_nums)
for num in x:
output *= num
if output > 10 ^ 18:
output = -1
if output <= -1:
output = -1
print(output)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s206373401 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | L, R = input().split()
print(int(R) * int(L))
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s278881629 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | N = int(input())
primeNum = [
2,
3,
5,
7,
11,
13,
17,
19,
23,
29,
31,
37,
41,
43,
47,
53,
59,
61,
67,
71,
73,
79,
83,
89,
97,
101,
103,
107,
109,
113,
127,
131,
137,
139,
149,
151,
157,
163,
167,
173,
179,
181,
191,
193,
197,
199,
211,
223,
227,
229,
233,
239,
241,
251,
257,
263,
269,
271,
277,
281,
283,
293,
307,
311,
313,
317,
331,
337,
347,
349,
353,
359,
367,
373,
379,
383,
389,
397,
401,
409,
419,
421,
431,
433,
439,
443,
449,
457,
461,
463,
467,
479,
487,
491,
499,
503,
509,
521,
523,
541,
547,
557,
563,
569,
571,
577,
587,
593,
599,
601,
607,
613,
617,
619,
631,
641,
643,
647,
653,
659,
661,
673,
677,
683,
691,
701,
709,
719,
727,
733,
739,
743,
751,
757,
761,
769,
773,
787,
797,
809,
811,
821,
823,
827,
829,
839,
853,
857,
859,
863,
877,
881,
883,
887,
907,
911,
919,
929,
937,
941,
947,
953,
967,
971,
977,
983,
991,
997,
1009,
1013,
1019,
1021,
1031,
1033,
1039,
1049,
1051,
1061,
1063,
1069,
1087,
1091,
1093,
1097,
1103,
1109,
1117,
1123,
1129,
1151,
1153,
1163,
1171,
1181,
1187,
1193,
1201,
1213,
1217,
1223,
1229,
1231,
1237,
1249,
1259,
1277,
1279,
1283,
1289,
1291,
1297,
1301,
1303,
1307,
1319,
1321,
1327,
1361,
1367,
1373,
1381,
1399,
1409,
1423,
1427,
1429,
1433,
1439,
1447,
1451,
1453,
1459,
1471,
1481,
1483,
1487,
1489,
1493,
1499,
1511,
1523,
1531,
1543,
1549,
1553,
1559,
1567,
1571,
1579,
1583,
1597,
1601,
1607,
1609,
1613,
1619,
1621,
1627,
1637,
1657,
1663,
1667,
1669,
1693,
1697,
1699,
1709,
1721,
1723,
1733,
1741,
1747,
1753,
1759,
1777,
1783,
1787,
1789,
1801,
1811,
1823,
1831,
1847,
1861,
1867,
1871,
1873,
1877,
1879,
1889,
1901,
1907,
1913,
1931,
1933,
1949,
1951,
1973,
1979,
1987,
1993,
1997,
1999,
]
pow = 1
time = 0
while True:
for p in primeNum:
z = p**pow
if p <= N:
if N % z == 0:
N = int(N / (z))
time += 1
else:
break
pow += 1
if pow >= N:
break
print(time)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s910611028 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | N, S = map(int, input().split())
A = list(map(int, input().split()))
m = 0
var1 = [0] * (S + 1)
var1[0] = pow(2, N, 998244353)
var2 = pow(2, 998244353 - 2, 998244353)
def func1(xxx, xx):
if xxx > xx:
return xx
else:
return xxx
for all in A:
m = all + m
funcvar1 = min(S, m)
for val in reversed(range(all, funcvar1 + 1)):
var1[val] = (var1[val] + var1[val - all] * var2) % 998244353
print(var1[S])
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s371070132 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | import bisect
from collections import defaultdict as dd
def factorize(n):
b = 2
fct = []
while b * b <= n:
while n % b == 0:
n //= b
fct.append(b)
b += 1
if n > 1:
fct.append(n)
return fct
N = int(input())
f = factorize(N)
dic = dd(int)
for val in f:
if val != 1:
dic[val] += 1
res = 0
ls = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66]
for val in dic.values():
tmp = bisect.bisect_right(ls, val)
res += tmp
print(res)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s663169060 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | input = list(map(int, input().split()))
print(input[0] * input[1])
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s867116188 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | try:
x = int(input("Enter a number:"))
y = int(input("Enter a number:"))
except:
print("Please enter a int.")
if x <= 100 and y <= 100:
if x >= 0 and y >= 0:
print(x * y)
else:
print("number not in range")
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s939829050 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | n, m = input().split()
print(int(n) * int(m))
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s883833379 | Wrong Answer | p02657 | Input is given from Standard Input in the following format:
A B | # 計算結果の出力
print(2 * 10)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s210118827 | Wrong Answer | p02657 | Input is given from Standard Input in the following format:
A B | print(2 * 5)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s901426567 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | X = input().split(" ")
print(X[0] * X[1])
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s835574078 | Wrong Answer | p02657 | Input is given from Standard Input in the following format:
A B | eval(input().strip().replace(" ", "*"))
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s070761953 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | arr = list(map(int, input().split()))
print(int(arr[0]) * int(arr[1]))
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s991315905 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | lst = list(map(int, input().split()))
print(str(lst[0] * lst[1]))
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s984850754 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | numbers = list(map(int, input().split()))
print(numbers[0] * numbers[1])
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s697357503 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | print(input() * input())
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s605596104 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | numa, numb = int(input().split())
print(numa * numb)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s714030270 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | input = input()
inputArr = input.split()
x = int(inputArr[0])
y = int(inputArr[1])
if x in range(1, 101):
if y in range(1, 101):
print(x * y)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s105769955 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | input()
a = 1
for i in input().split():
a *= int(i)
print([a, -1][a > 1000000000000000000])
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s153417143 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | def prime(n):
nums = [True] * n
primes = []
for i in range(2, n):
if nums[i]:
primes.append(i)
for j in range(2 * i, n, i):
nums[j] = False
return primes
def prime_fac(n):
fac = {}
primes = prime(int(n**0.5) + 1)
for p in primes:
while n % p == 0:
fac[p] = fac.get(p, 0) + 1
n //= p
if n > 1:
fac[n] = 1
return fac
def main():
n = int(input())
fac = prime_fac(n)
ans = 0
for i in fac.values():
ct = 1
while i >= ct * (ct + 1) // 2:
ct += 1
ans += 1
print(ans)
main()
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s068532419 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | ab = int, input().split()
print(ab[0] * ab[1])
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s034457007 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | x, y = input().split()
print(int(x) * int(y))
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s308929142 | Wrong Answer | p02657 | Input is given from Standard Input in the following format:
A B | s = input()
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s811577531 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | number = int(input()).split("")
print(number[0] * number[1])
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s761912329 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | int_list = list(map(int, input().split()))
print(int_list[0] * int_list[1])
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s342663218 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | input_x = int(input("x="))
input_y = int(input("y="))
print("We have", input_x * input_y)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s354806961 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | A,B=map(int, input().split())
print(A*B) | Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s019888601 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | t1 = int(input())
t2 = int(input())
print(t1 * t2)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s878812814 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | n = input().split(" ")
for i in range(0, len(n)):
n[i] = int(n[i])
print(n[0] * n[1])
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s818607841 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | inputs = list(input().split())
A = int(inputs[0])
B = int(float(inputs[1]) * 100 // 1)
Ans = A * B / 100 // 1
print(int(Ans))
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s258114715 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | n = int(input())
arr = list(map(int, input().split()))
mul = eval("*".join([str(n) for n in arr]))
print("-1" if mul > (10**18) else mul)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s704021454 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | import sys
def main(lines):
# このコードは標準入力と標準出力を用いたサンプルコードです。
# このコードは好きなように編集・削除してもらって構いません。
# ---
# This is a sample code to use stdin and stdout.
# Edit and remove this code as you like.
for i, v in enumerate(lines):
print("line[{0}]: {1}".format(i, v))
if __name__ == "__main__":
lines = []
for l in sys.stdin:
lines.append([int(s) for s in l.rstrip("\r\n").split()])
A = lines[0]
B = lines[1]
print(A * B)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s787759786 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | i = list(map(int, input().split()))
print(i[0] * i[1])
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s532897388 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | Left, Right = map(int, input().split())
Answer = Left * Right
print(Answer)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s636454144 | Wrong Answer | p02657 | Input is given from Standard Input in the following format:
A B | print(map(lambda x, y: x * x, map(int, input("").split())))
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s547317129 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | S1, S2 = input().strip().split()
print(S1 * S2)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s907044746 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | a,b = int(input())
Z = a*b
print(Z)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s753281414 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | print(int(int(input()) * int(input())))
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s185437251 | Accepted | p02657 | Input is given from Standard Input in the following format:
A B | print((lambda a, b: a * b)(*map(int, input().split())))
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s444922194 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | s = input()
a, b = s.split(" ")
a = (int)(a)
x, y = b.split(".")
x = (int)(x)
y = (int)(y)
a1 = a * x
a2 = a * y
a2 = (int)(a2 / 100)
print((a1 + a2), end=" ")
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s206386045 | Wrong Answer | p02657 | Input is given from Standard Input in the following format:
A B | ab = input()
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
Print the value A \times B as an integer.
* * * | s048281539 | Runtime Error | p02657 | Input is given from Standard Input in the following format:
A B | num1 = int(input())
num2 = int(input())
mul = num1 * num2
print(mul)
| Statement
Compute A \times B. | [{"input": "2 5", "output": "10\n \n\nWe have 2 \\times 5 = 10.\n\n* * *"}, {"input": "100 100", "output": "10000"}] |
For each dataset, output the correspondence between the switches and the light
bulbs consisting of $M$ numbers written in base-$36$. In the base-$36$ system
for this problem, the values $0$-$9$ and $10$-$35$ are represented by the
characters '0'-'9' and 'A'-'Z' respectively. The $i$-th character of the
correspondence means the number of the switch controlling the $i$-th light
bulb. If you cannot determine which switch controls the $i$-th light bulb,
output '?' as the $i$-th character instead of the number of a switch. | s367691272 | Runtime Error | p01702 | The input consists of multiple datasets. The number of dataset is no more than
$50$ and the file size is no more than $10\mathrm{MB}$. Each dataset is
formatted as follows.
> $N$ $M$ $Q$
> $S_1$ $B_1$
> :
> :
> $S_Q$ $B_Q$
The first line of each dataset contains three integers $N$ ($1 \le N \le 36$),
$M$ ($1 \le M \le 1{,}000$), $Q$ ($0 \le Q \le 1{,}000$), which denote the
number of switches, the number of light bulbs and the number of operations
respectively. The following $Q$ lines describe the information about the
switches you have operated and the states of the light bulbs you have checked.
The $i$-th of them contains two strings $S_i$ and $B_i$ of lengths $N$ and $M$
respectively. Each $S_i$ denotes the set of the switches you have operated:
$S_{ij}$ is either $0$ or $1$, which denotes the $j$-th switch is not operated
or operated respectively. Each $B_i$ denotes the states of the light bulbs:
$B_{ij}$ is either $0$ or $1$, which denotes the $j$-th light bulb is off or
on respectively.
You can assume that there exists a correspondence between the switches and the
light bulbs which is consistent with the given information.
The end of input is indicated by a line containing three zeros. | while 1:
n, m, q = map(int, input().split())
if (n | m | q) == 0:
break
p = []
res = [[_ for _ in range(n)] for _ in range(m)]
for i in range(q):
s, b = [[int(c) for c in s] for s in input().split()]
if i > 0:
for j in range(n):
s[j] ^= p[j]
for j in range(n):
for k in range(m):
if s[j] != b[k] and j in res[k]:
res[k].remove(j)
p = s
table = "".join(
[str(i) for i in range(10)] + [chr(ord("A") + i) for i in range(26)]
)
for i in range(m):
if len(res[i]) == 1:
print(table[res[i][0]], sep="", end="")
else:
print("?", sep="", end="")
print()
| Statement
In the headquarter building of ICPC (International Company of Plugs &
Connectors), there are $M$ light bulbs and they are controlled by $N$
switches. Each light bulb can be turned on or off by exactly one switch. Each
switch may control multiple light bulbs. When you operate a switch, all the
light bulbs controlled by the switch change their states. You lost the table
that recorded the correspondence between the switches and the light bulbs, and
want to restore it.
You decided to restore the correspondence by the following procedure.
* At first, every switch is off and every light bulb is off.
* You operate some switches represented by $S_1$.
* You check the states of the light bulbs represented by $B_1$.
* You operate some switches represented by $S_2$.
* You check the states of the light bulbs represented by $B_2$.
* ...
* You operate some switches represented by $S_Q$.
* You check the states of the light bulbs represented by $B_Q$.
After you operate some switches and check the states of the light bulbs, the
states of the switches and the light bulbs are kept for next operations.
Can you restore the correspondence between the switches and the light bulbs
using the information about the switches you have operated and the states of
the light bulbs you have checked? | [{"input": "10 3\n 000 0000000000\n 110 0000001111\n 101 1111111100\n 2 2 0\n 1 1 0\n 2 1 1\n 01 1\n 11 11 10\n 10000000000 10000000000\n 11000000000 01000000000\n 01100000000 00100000000\n 00110000000 00010000000\n 00011000000 00001000000\n 00001100000 00000100000\n 00000110000 00000010000\n 00000011000 00000001000\n 00000001100 00000000100\n 00000000110 00000000010\n 0 0 0", "output": "??\n 0\n 1\n 0123456789A"}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s326305511 | Accepted | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | 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:]))
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s275702743 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | N = int(input())
L = list(map(int, input().split()))
L = [i // 400 for i in L]
s = 0
k = 0
for i in L:
if i > 7:
k += 1
L = list(set(L))
for i in L:
if i < 8:
s += 1
print(s, min(k + s, 8))
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s726064913 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | N = int(input())
X = list(map(int, input().split()))
X = [x//400 for x in X]
min_X = len(set([x for x in X if x < 8]))
max_X = min_X + len([x for x in X if x >= 8])
# この max は気づかないなあ
print(max([min_X, 1], max_X)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s123996111 | Accepted | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | import math
import numpy as np
n = int(input())
a = list(map(int, input().split()))
check = [0] * 9
for i, val in enumerate(a):
tar = math.floor(val / 400)
if tar > 8:
tar = 8
check[int(tar)] += 1
checkA = np.array(check[:8])
# print(checkA)
num = np.count_nonzero(checkA != 0)
less = max(num, 1)
# more = min(8, num + check[8])
more = num + check[8]
# print(check[8])
print(less, more)
"""
checkA = np.array(check[:8])
num = np.count_nonzero(checkA != 0)
if (num == 0):
num = 1
rest = 8 - num
more = min(8, num + check[8])
print(num, more)
"""
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s127834056 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | N = input()
L = [1, 2, 3, 4, 5, 6, 7, 8]
M = 0
for x in input().split():
x = int(x)
if 400 > x:
v = 1
elif 800 > x:
v = 2
elif 1200 > x:
v = 3
elif 1600 > x:
v = 4
elif 2000 > x:
v = 5
elif 2400 > x:
v = 6
elif 2800 > x:
v = 7
elif 3200 > x:
v = 8
else:
M += 1
continue
if v in L:
L.remove(v)
C = 8 - len(L)
print(str(C) + " " + str(C + M))
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s539826498 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | N = int(input())
lsa = list(map(int, input().split()))
lsb = []
joker = 0
for i in lsa:
if i >= 1 and i <= 399:
lsb.append("1")
elif i >= 400 and i <= 799:
lsb.append("2")
elif i >= 800 and i <= 1199:
lsb.append("3")
elif i >= 1200 and i <= 1599:
lsb.append("4")
elif i >= 1600 and i <= 1999:
lsb.append("5")
elif i >= 2000 and i <= 2399:
lsb.append("6")
elif i >= 2400 and i <= 2799:
lsb.append("7")
elif i >= 2800 and i <= 3199:
lsb.append("8")
elif i >= 3200:
joker += 1
s1 = len(set(lsb))
s2 = s1 + joker
print(s1, s2)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s761411069 | Accepted | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | 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)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s940729172 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | 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 < len(bigList):
print(len(bigList), max)
else:
print(color_val, max)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s897993770 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n=int(input())
a=list(map(int,input().split()))
b=[0]*9
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:
b[8]+=1
min=8-b[:8].count(0)
max=min+b[8]
if min=0:
min=1
print(min,max) | 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s114170629 | Accepted | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | N = int(input())
L = list(map(int, input().split()))
L = [i // 400 for i in L]
a = [i for i in L if i < 8]
b = [i for i in L if i > 7]
a = len(set(a))
b = len(b)
if a == 0:
mi = 1
ma = b
else:
mi = a
ma = mi + b
print(mi, ma)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s904706053 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n = int(input())
A = list(map(int, input().split()))
Colors = []
High_scorer = []
for a in A:
if a < 400:
Colors.append("Gray")
if 400 <= a and a < 800:
Colors.append("Brown")
if 800 <= a and a < 1200:
Colors.append("Green")
if 1200 <= a and a < 1600:
Colors.append("Light_blue")
if 1600 <= a and a < 2000:
Colors.append("Blue")
if 2000 <= a and a < 2400:
Colors.append("Yellow")
if 2400 <= a and a < 2800:
Colors.append("Orange")
if 2800 <= a and a < 3200:
Colors.append("Red")
if 3200 <= a:
High_scorer.append(a)
MIN = len(set(Colors))
H = len(High_scorer)
MIN >= 1:
print(MIN, (MIN+H))
MIN = 0:
print(1, H) | 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s522115372 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n = int(input())
nums = list(map(int, input().split()))
num_free = 0
num_color = [False] * 8
for rate in nums:
if rate < 3200:
num_color(rate // 400) = True
else:
num_free += 1
ans = sum(num_color)
print("{} {}".format(ans, ans + num_free))
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s781479386 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n=int(input())
r=list(map(int,input().split()))
rlist=[]
def color(n):
if n<400:
return 1
elif n<800:
return 2
elif n<1200:
return 3
elif n<1600:
return 4
elif n<2000:
return 5
elif n<2400:
return 6
elif n<2800:
return 7
elif n<3200:
return 8
else:
return 9
for _ in range(n):
co=color(r[_])
rlist.append(co)
ans1=len(set(rlist))
if rlist.count(9)==0:
print(ans1,ans1,sep=" ")
elif ans1=1:
print(1,min(8,rlist.count(9),sep=" ")
else:
print(min(8,ans1-1),min(8,ans1-1+rlist.count(9)),sep=" ") | 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s213295157 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | N = int(input())
a = list(map(int,input().split()))
color = [False]*8
over_human = 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
elif(i>=3200):
over_human += 1
if(color.count(True)==0):
print(1,color.count(True)+over_human))
else:
print(color.count(True),color.count(True)+over_human))
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s610890343 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n=int(input())
r=list(map(int,input().split()))
rlist=[]
def color(n):
if n<400:
return 1
elif n<800:
return 2
elif n<1200:
return 3
elif n<1600:
return 4
elif n<2000:
return 5
elif n<2400:
return 6
elif n<2800:
return 7
elif n<3200:
return 8
else:
return 9
for _ in range(n):
co=color(r[_])
rlist.append(co)
ans1=len(set(rlist))
if rlist.count(9)==0:
print(ans1,ans1,sep=" ")
elif ans1==1:
print(1,min(8,rlist.count(9),sep=" ")
else:
print(min(8,ans1-1),min(8,ans1-1+rlist.count(9)),sep=" ")
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s952085414 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | #
# abc064 c
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
out = sys.stdout.read()[:-1]
sys.stdout, sys.stdin = stdout, stdin
self.assertEqual(out, output)
def test_入力例_1(self):
input = """4
2100 2500 2700 2700"""
output = """2 2"""
self.assertIO(input, output)
def test_入力例_2(self):
input = """5
1100 1900 2800 3200 3200"""
output = """3 5"""
self.assertIO(input, output)
def test_入力例_3(self):
input = """20
800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990"""
output = """1 1"""
self.assertIO(input, output)
def resolve():
N = int(input())
A = list(map(int, input().split()))
C = [0] * 9
for a in A:
for i in range(8):
if 400 * i <= a <= 400 * i + 399:
C[i] = 1
break
else:
C[8] += 1
print(f"{max(1, C[:8].count(1))} {C[:8].count(1)+C[8])}")
if __name__ == "__main__":
# unittest.main()
resolve()
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s240641258 | Accepted | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | def process(N, A):
rates = set()
over_rates = 0
for a in A:
a //= 400
if a < 8:
rates.add(a)
else:
over_rates += 1
minimum = max(len(rates), 1)
maximum = len(rates) + over_rates
return minimum, maximum
N = int(input())
A = map(int, input().split())
minimum, maximum = process(N, A)
print(minimum, maximum)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s182763646 | Accepted | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | from collections import OrderedDict
N = int(input())
a = [int(v) for v in input().split()]
color = OrderedDict(
[
(399, 0),
(799, 0),
(1199, 0),
(1599, 0),
(1999, 0),
(2399, 0),
(2799, 0),
(3199, 0),
]
)
free_num = 0
for v in a:
if v >= 3200:
free_num += 1
else:
for top in color.keys():
if v <= top:
color[top] += 1
break
ans_min = 0
for v in color.values():
if v != 0:
ans_min += 1
ans_max = ans_min + free_num
if ans_min == 0:
ans_min += 1
print("{0} {1}".format(ans_min, ans_max))
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s999531699 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n = int(input())
lst0 = list(map(int, input().split()))
lst1 = [0, 0, 0, 0, 0, 0, 0, 0]
god = 0
Mx, Mn = (0, 0)
for i in range(n):
if 1 <= lst0[i] <= 399:
lst1[0] += 1
elif 400 <= lst0[i] <= 799:
lst1[1] += 1
elif 800 <= lst0[i] <= 1199:
lst1[2] += 1
elif 1200 <= lst0[i] <= 1599:
lst1[3] += 1
elif 1600 <= lst0[i] <= 1999:
lst1[4] += 1
elif 2000 <= lst0[i] <= 2399:
lst1[5] += 1
elif 2400 <= lst0[i] <= 2799:
lst1[6] += 1
elif 2800 <= lst0[i] <= 3199:
lst1[7] += 1
else:
god += 1
Mn = 8 - lst1.count(0)
Mx = Mn + god
if Mx > 8:
Mx = 8
print(str(Mn) + " " + str(Mx))
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s447816213 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | N = int(input())
nums = input().split()
r1 = 0
r2 = 0
r3 = 0
r4 = 0
r5 = 0
r6 = 0
r7 = 0
r8 = 0
r9 = 0
for n in range(0, N):
if 1 <= int(nums[n]) <= 399:
r1 = 1
if 400 <= int(nums[n]) <= 799:
r2 = 1
if 800 <= int(nums[n]) <= 1199:
r3 = 1
if 1200 <= int(nums[n]) <= 1599:
r4 = 1
if 1600 <= int(nums[n]) <= 1999:
r5 = 1
if 2000 <= int(nums[n]) <= 2399:
r6 = 1
if 2400 <= int(nums[n]) <= 2799:
r7 = 1
if 2800 <= int(nums[n]) <= 3199:
r8 = 1
if 3200 <= int(nums[n]):
r9 = r9 + 1
p1 = r1 + r2 + r3 + r4 + r5 + r6 + r7 + r8 + r9
p2 = r1 + r2 + r3 + r4 + r5 + r6 + r7 + r8
print(p2, p1)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s631447138 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n = int(input())
rates = list(map(int, input().split()))
over3200 = sum(1 for i in rates if i >= 3200)
fixed = set()
for i in rates:
if i // 400 <= 7:
fixed.add(i // 400)
f = len(fixed)
print(fixed)
if f == 0:
print(1, over3200)
else:
print(f, f + over3200)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s084291718 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n = int(input())
li = list(map(int, input().split()))
co_li = [0] * 8
any_col = 0
for s in li:
if s < 400:
co_li[0] += 1
elif 400 <= s < 800:
co_li[1] += 1
elif 800 <= s < 1200:
co_li[2] += 1
elif 1200 <= s < 1600:
co_li[3] += 1
elif 1600 <= s < 2000:
co_li[4] += 1
elif 2000 <= s < 2400:
co_li[5] += 1
elif 2400 <= s < 2800:
co_li[6] += 1
elif 2800 <= s < 3200:
co_li[7] += 1
elif 3200 <= s:
any_col += 1
color_kind = sum(x > 0 for x in co_li)
min_sum = color_kind
max_sum = min_sum + any_col
print(min_sum, max_sum)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s538926042 | Accepted | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 28 21:42:33 2016
@author: you
"""
n = int(input())
a = list(map(int, input().split()))
colornum = 0
colorflag = [0, 0, 0, 0, 0, 0, 0, 0]
rainbow = 0
maxvalue = 0
minvalue = 0
for i in range(n):
if colorflag[0] == 0 and a[i] < 400:
colornum = colornum + 1
colorflag[0] = 1
elif colorflag[1] == 0 and a[i] >= 400 and a[i] < 800:
colornum = colornum + 1
colorflag[1] = 1
elif colorflag[2] == 0 and a[i] >= 800 and a[i] < 1200:
colornum = colornum + 1
colorflag[2] = 1
elif colorflag[3] == 0 and a[i] >= 1200 and a[i] < 1600:
colornum = colornum + 1
colorflag[3] = 1
elif colorflag[4] == 0 and a[i] >= 1600 and a[i] < 2000:
colornum = colornum + 1
colorflag[4] = 1
elif colorflag[5] == 0 and a[i] >= 2000 and a[i] < 2400:
colornum = colornum + 1
colorflag[5] = 1
elif colorflag[6] == 0 and a[i] >= 2400 and a[i] < 2800:
colornum = colornum + 1
colorflag[6] = 1
elif colorflag[7] == 0 and a[i] >= 2800 and a[i] < 3200:
colornum = colornum + 1
colorflag[7] = 1
elif a[i] >= 3200:
rainbow = rainbow + 1
for j in range(8):
if colorflag[j] == 1:
minvalue = minvalue + 1
maxvalue = minvalue + rainbow
if minvalue == 0:
minvalue = 1
maxvalue = rainbow
print(minvalue, maxvalue)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s237032479 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | N = int(input())
rate = list( map(int, input().split()))
color = [0] * 9
a = 400
flag = 1
for i in range(0,N):
if 8*a <= rate[i]:
color[8] += 1
else:
flag = 0
if rate[i] < a:
color[0] = 1
elif a <= rate[i] < 2*a:
color[1] = 1
elif 2*a <= rate[i] < 3*a:
color[2] = 1
elif 3*a <= rate[i] < 4*a:
color[3] = 1
elif 4*a <= rate[i] < 5*a:
color[4] = 1
elif 5*a <= rate[i] < 6*a:
color[5] = 1
elif 6*a <= rate[i] < 7*a:
color[6] = 1
elif 7*a <= rate[i] < 8*a:
color[7] = 1
min_color = 0
max_color = 0
min_color = color.count(1)
max_color = min_color + color[8]
if max_color > = 8:
max_color = 8
print(min_color,max_color) | 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s482571553 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | N = int(input())
A = list(map(int, input().split()))
B = [0, 0, 0, 0, 0, 0, 0, 0, 0]
mi = 0
for i in range(len(A)):
for t in range(len(B)):
if A[i] < (400 * (t + 1)):
B[t] = B[t] + 1
for t in range(len(B) - 1):
if B[t] > 0:
mi = mi + 1
ma = mi + B[-1]
print(ma + mi)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s768815652 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | memTime = int(input())
memLate = input().split()
memLate = [int(i) for i in memLate]
colorList = []
memColor = 0
highLate = 0
for color in memLate:
if color // 400 >= 8:
highLate += 1
elif ((color // 400) in colorList) == False:
colorList.append(color // 400)
maxColor = len(colorList) + highLate
print(str(len(colorList)) + " " + str(maxColor))
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s619526541 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | N = int(input())
A = list(map(int, input().split()))
color = [False] * 8
over3200 = 0
for a in A:
for i in range(8):
if 400*i =< a < 400*(i+1):
color[i] = True
break
else:
over3200 += 1
if sum(color):
print(sum(color), end=' ')
print(sum(color) + over3200)
else:
print(1, end=' ')
print(over3200)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s267026563 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n, *a = map(int, open(0).read().split())
b = [0 for i in range(9)]
for s in a:
if s < 3200:
b[s // 400] = 1
else:
b[8] += 1
print(sum(b[:8]), sum(b))
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s152131499 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n=int(input())
def f(x):
return x//400 if x<3200 else return 8
l=set(map(lambda x:x//400 if x < 3200 else 8 ,list(map(int,input().split()))))
print(l) | 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s043549599 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | for i in range(n):
b.append(a[i] // 400)
for i in range(13):
if b.count(i) >= 1:
if i <= 7:
countmax += 1
countmin += 1
else:
countmax += b.count(i)
print(countmin, countmax)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s970024060 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n=int(input())
rates=list(map(int,input().split()))
over3200=sum(1 for i in rates if i>=3200)
fixed=set()
for i in rates:
if i//<=7:
fixed.add(i)
f=len(fixed)
if f==0:
print(1,over3200)
else:
print(f,f+over3200) | 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s936254249 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n, *a = map(lambda x: int(x) // 400, open(0).read().split())
k = len(set(a + [8])) - 1
print(k or 1, a.count(8) + k)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s807603734 | Runtime Error | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | N=int(input())
a=[int(i)//400 for i in input().split()]
s=set()
r=0
for i in range(N):
if a[i]==7:
r+=1
else:
s.add(a[i])
print("{0} {1}".format(min([1,len(s)]),len(s)+r) | 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s584522109 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n = int(input())
a = [0] * 9
i = input().split()
for x in range(n):
y = int(i[x])
if 1 <= y <= 399:
a[0] += 1
elif 400 <= y <= 799:
a[1] += 1
elif 800 <= y <= 1199:
a[2] += 1
elif 1200 <= y <= 1599:
a[3] += 1
elif 1600 <= y <= 1999:
a[4] += 1
elif 2000 <= y <= 2399:
a[5] += 1
elif 2400 <= y <= 2799:
a[6] += 1
elif 2800 <= y <= 3199:
a[7] += 1
else:
a[8] += 1
count = 0
for x in range(8):
if a[x] > 0:
count += 1
max = count + a[8]
if max > 8:
max = 8
if count == 0 and a[8] > 0:
count = 1
print(count, max)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s772387698 | Accepted | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | n = int(input())
l = list(map(int, input().split()))
scores = [0, 0, 0, 0, 0, 0, 0, 0]
x = 0
def evaluation(list):
for i in list:
if 0 <= i <= 399:
scores[0] = 1
elif 400 <= i <= 799:
scores[1] = 1
elif 800 <= i <= 1199:
scores[2] = 1
elif 1200 <= i <= 1599:
scores[3] = 1
elif 1600 <= i <= 1999:
scores[4] = 1
elif 2000 <= i <= 2399:
scores[5] = 1
elif 2400 <= i <= 2799:
scores[6] = 1
elif 2800 <= i <= 3199:
scores[7] = 1
for j in range(n):
if l[j] >= 3200:
x += 1
evaluation(l)
y = sum(scores)
if n == 1:
print(1, 1)
else:
print(max(1, y), y + x)
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
Print the minimum possible number of different colors of the users, and the
maximum possible number of different colors, with a space in between.
* * * | s135022282 | Wrong Answer | p03695 | Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N | N = int(input())
l = list(map(int, input().split()))
flag1 = True
flag2 = True
flag3 = True
flag4 = True
flag5 = True
flag6 = True
flag7 = True
flag8 = True
Max = 0
Min = 0
for value in l:
if 0 < value and value < 400 and flag1 == True:
flag1 = False
Max += 1
Min += 1
elif 400 <= value and value < 800 and flag2 == True:
flag2 = False
Max += 1
Min += 1
elif 800 <= value and value < 1200 and flag3 == True:
flag3 = False
Max += 1
Min += 1
elif 1200 <= value and value < 1600 and flag4 == True:
flag4 = False
Max += 1
Min += 1
elif 1600 <= value and value < 2000 and flag5 == True:
flag5 = False
Max += 1
Min += 1
elif 2000 <= value and value < 2400 and flag6 == True:
flag6 = False
Max += 1
Min += 1
elif 2400 <= value and value < 2800 and flag7 == True:
flag7 = False
Max += 1
Min += 1
elif 2800 <= value and value < 3200 and flag8 == True:
flag8 = False
Max += 1
Min += 1
else:
Max += 1
print(str(Min) + " " + str(Max))
| 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. | [{"input": "4\n 2100 2500 2700 2700", "output": "2 2\n \n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are\ntwo different colors.\n\n* * *"}, {"input": "5\n 1100 1900 2800 3200 3200", "output": "3 5\n \n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and\nthe user with rating 2800 is \"red\". \nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are\nthree different colors. This is one possible scenario for the minimum number\nof colors. \nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are\nfive different colors. This is one possible scenario for the maximum number of\ncolors.\n\n* * *"}, {"input": "20\n 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990", "output": "1 1\n \n\nAll the users are \"green\", and thus there is one color."}] |
If S consists of exactly two kinds of characters which both appear twice in S,
print `Yes`; otherwise, print `No`.
* * * | s305193569 | Accepted | p02987 | Input is given from Standard Input in the following format:
S | print("Yes") if len(set(list(input()))) == 2 else print("No")
| Statement
You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear
twice in S. | [{"input": "ASSA", "output": "Yes\n \n\nS consists of `A` and `S` which both appear twice in S.\n\n* * *"}, {"input": "STOP", "output": "No\n \n\n* * *"}, {"input": "FFEE", "output": "Yes\n \n\n* * *"}, {"input": "FREE", "output": "No"}] |
If S consists of exactly two kinds of characters which both appear twice in S,
print `Yes`; otherwise, print `No`.
* * * | s856610046 | Accepted | p02987 | Input is given from Standard Input in the following format:
S | print("YNeos"[len({*input()}) != 2 :: 2])
| Statement
You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear
twice in S. | [{"input": "ASSA", "output": "Yes\n \n\nS consists of `A` and `S` which both appear twice in S.\n\n* * *"}, {"input": "STOP", "output": "No\n \n\n* * *"}, {"input": "FFEE", "output": "Yes\n \n\n* * *"}, {"input": "FREE", "output": "No"}] |
If S consists of exactly two kinds of characters which both appear twice in S,
print `Yes`; otherwise, print `No`.
* * * | s737239511 | Runtime Error | p02987 | Input is given from Standard Input in the following format:
S | import sys
def input():
return sys.stdin.readline()[:-1]
NM = list(map(int, input().split()))
N = NM[0]
M = NM[1]
graph = [[] for j in range(N)]
for i in range(M):
edge = list(map(int, input().split()))
graph[edge[0] - 1].append(edge[1] - 1)
ST = list(map(int, input().split()))
S = ST[0] - 1
T = ST[1] - 1
first = []
second = []
third = []
able = [S]
step = 0
while True:
first = []
second = []
third = []
judge = 0
for i in range(len(able)):
for j in range(len(graph[able[i]])):
if not (graph[able[i]][j] in first):
first.append(graph[able[i]][j])
for i in range(len(first)):
for j in range(len(graph[first[i]])):
if not (graph[first[i]][j] in second):
second.append(graph[first[i]][j])
for i in range(len(second)):
for j in range(len(graph[second[i]])):
if not (graph[second[i]][j] in third):
third.append(graph[second[i]][j])
for i in range(len(third)):
if not third[i] in able:
able.append(third[i])
judge = 1
if judge == 0:
print(-1)
break
step += 1
if T in able:
print(step)
break
| Statement
You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear
twice in S. | [{"input": "ASSA", "output": "Yes\n \n\nS consists of `A` and `S` which both appear twice in S.\n\n* * *"}, {"input": "STOP", "output": "No\n \n\n* * *"}, {"input": "FFEE", "output": "Yes\n \n\n* * *"}, {"input": "FREE", "output": "No"}] |
If S consists of exactly two kinds of characters which both appear twice in S,
print `Yes`; otherwise, print `No`.
* * * | s471813726 | Runtime Error | p02987 | Input is given from Standard Input in the following format:
S | # coding: utf-8
# Your code here!
N, M = map(int, input().split())
hen = [list(map(int, input().split())) for i in range(M)]
S, T = map(int, input().split())
hen2 = []
for i in range(N):
a = []
for j in hen:
if j[0] == i + 1:
a.append(j[1])
hen2.append(a)
queue = [[S, 0]]
check = []
dist = [0]
while True:
if queue == []:
print(-1)
break
Now = queue.pop(0)
ndist = dist.pop(0)
if Now == [T, 0]:
print(int(ndist / 3))
break
check.append(Now)
for i in hen2[Now[0] - 1]:
if [i, (Now[1] + 1) % 3] not in check:
queue.append([i, (Now[1] + 1) % 3])
dist.append(ndist + 1)
| Statement
You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear
twice in S. | [{"input": "ASSA", "output": "Yes\n \n\nS consists of `A` and `S` which both appear twice in S.\n\n* * *"}, {"input": "STOP", "output": "No\n \n\n* * *"}, {"input": "FFEE", "output": "Yes\n \n\n* * *"}, {"input": "FREE", "output": "No"}] |
If S consists of exactly two kinds of characters which both appear twice in S,
print `Yes`; otherwise, print `No`.
* * * | s895571928 | Accepted | p02987 | Input is given from Standard Input in the following format:
S | C = set(s_i for s_i in input())
print("Yes" if len(C) == 2 else "No")
| Statement
You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear
twice in S. | [{"input": "ASSA", "output": "Yes\n \n\nS consists of `A` and `S` which both appear twice in S.\n\n* * *"}, {"input": "STOP", "output": "No\n \n\n* * *"}, {"input": "FFEE", "output": "Yes\n \n\n* * *"}, {"input": "FREE", "output": "No"}] |
If S consists of exactly two kinds of characters which both appear twice in S,
print `Yes`; otherwise, print `No`.
* * * | s163569773 | Accepted | p02987 | Input is given from Standard Input in the following format:
S | l = input()
print("Yes" if len(set(l)) == 2 and l.count(l[0]) == 2 else "No")
| Statement
You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear
twice in S. | [{"input": "ASSA", "output": "Yes\n \n\nS consists of `A` and `S` which both appear twice in S.\n\n* * *"}, {"input": "STOP", "output": "No\n \n\n* * *"}, {"input": "FFEE", "output": "Yes\n \n\n* * *"}, {"input": "FREE", "output": "No"}] |
If S consists of exactly two kinds of characters which both appear twice in S,
print `Yes`; otherwise, print `No`.
* * * | s211810911 | Accepted | p02987 | Input is given from Standard Input in the following format:
S | print("Yes" if len(set(input())) == 2 else "No")
| Statement
You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear
twice in S. | [{"input": "ASSA", "output": "Yes\n \n\nS consists of `A` and `S` which both appear twice in S.\n\n* * *"}, {"input": "STOP", "output": "No\n \n\n* * *"}, {"input": "FFEE", "output": "Yes\n \n\n* * *"}, {"input": "FREE", "output": "No"}] |
If S consists of exactly two kinds of characters which both appear twice in S,
print `Yes`; otherwise, print `No`.
* * * | s958223658 | Accepted | p02987 | Input is given from Standard Input in the following format:
S | # -*- coding: utf-8 -*-
# abc132/abc132_a
import sys
import collections
s2nn = lambda s: [int(c) for c in s.split(" ")]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))
def main():
S = i2s()
c = collections.Counter(S)
if tuple(c.values()) == (2, 2):
print("Yes")
else:
print("No")
return
main()
| Statement
You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear
twice in S. | [{"input": "ASSA", "output": "Yes\n \n\nS consists of `A` and `S` which both appear twice in S.\n\n* * *"}, {"input": "STOP", "output": "No\n \n\n* * *"}, {"input": "FFEE", "output": "Yes\n \n\n* * *"}, {"input": "FREE", "output": "No"}] |
If S consists of exactly two kinds of characters which both appear twice in S,
print `Yes`; otherwise, print `No`.
* * * | s413117961 | Runtime Error | p02987 | Input is given from Standard Input in the following format:
S | n = int(input())
p = [int(i) for i in input().split()]
ctn = 0
for j in range(1, n - 1):
if p[j - 1] < p[j] < p[j + 1] or p[j + 1] < p[j] < p[j - 1]:
ctn += 1
print(ctn)
| Statement
You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear
twice in S. | [{"input": "ASSA", "output": "Yes\n \n\nS consists of `A` and `S` which both appear twice in S.\n\n* * *"}, {"input": "STOP", "output": "No\n \n\n* * *"}, {"input": "FFEE", "output": "Yes\n \n\n* * *"}, {"input": "FREE", "output": "No"}] |
If S consists of exactly two kinds of characters which both appear twice in S,
print `Yes`; otherwise, print `No`.
* * * | s453306922 | Runtime Error | p02987 | Input is given from Standard Input in the following format:
S | N, K = map(int, input().split(" "))
red = N - K
p = 10**9 + 7
def comb(n, k, p):
"""power_funcを用いて(nCk) mod p を求める"""
from math import factorial
if n < 0 or k < 0 or n < k:
return 0
if n == 0 or k == 0:
return 1
a = factorial(n) % p
b = factorial(k) % p
c = factorial(n - k) % p
return (a * power_func(b, p - 2, p) * power_func(c, p - 2, p)) % p
def power_func(a, b, p):
"""a^b mod p を求める"""
if b == 0:
return 1
if b % 2 == 0:
d = power_func(a, b // 2, p)
return d * d % p
if b % 2 == 1:
return (a * power_func(a, b - 1, p)) % p
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
for i in range(1, K + 1):
print(comb(red + 1, i, p) * comb(K - 1, i - 1, p) % p)
| Statement
You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear
twice in S. | [{"input": "ASSA", "output": "Yes\n \n\nS consists of `A` and `S` which both appear twice in S.\n\n* * *"}, {"input": "STOP", "output": "No\n \n\n* * *"}, {"input": "FFEE", "output": "Yes\n \n\n* * *"}, {"input": "FREE", "output": "No"}] |
If S consists of exactly two kinds of characters which both appear twice in S,
print `Yes`; otherwise, print `No`.
* * * | s509654335 | Runtime Error | p02987 | Input is given from Standard Input in the following format:
S | # xの逆元は、x*y = 1 mod pとなるようなy
N, K = map(int, input().split())
mod = 10**9 + 7
a = N - K + 1
print(a)
for i in range(K - 1):
a = a * (N - K - i) * (K - (i + 1)) // ((i + 2) * (i + 1)) % mod
print(a)
| Statement
You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear
twice in S. | [{"input": "ASSA", "output": "Yes\n \n\nS consists of `A` and `S` which both appear twice in S.\n\n* * *"}, {"input": "STOP", "output": "No\n \n\n* * *"}, {"input": "FFEE", "output": "Yes\n \n\n* * *"}, {"input": "FREE", "output": "No"}] |
Compute the sum of products of simple cycles that have exactly two special
edges. Print the answer modulo (10^9+7).
* * * | s838364286 | Wrong Answer | p02591 | Input is given from Standard Input in the following format (where L =
2^{H-1}).
H
P_1 P_2 \cdots P_L | #
| Statement
Inspired by the tv series _Stranger Things_ , bear Limak is going for a walk
between two mirror worlds.
There are two perfect binary trees of height H, each with the standard
numeration of vertices from 1 to 2^H-1. The root is 1 and the children of x
are 2 \cdot x and 2 \cdot x + 1.
Let L denote the number of leaves in a single tree, L = 2^{H-1}.
You are given a permutation P_1, P_2, \ldots, P_L of numbers 1 through L. It
describes L _special_ edges that connect leaves of the two trees. There is a
special edge between vertex L+i-1 in the first tree and vertex L+P_i-1 in the
second tree.

_drawing for the first sample test, permutation P = (2, 3, 1, 4), special
edges in green_
Let's define _product_ of a cycle as the product of numbers in its vertices.
Compute the sum of products of all simple cycles that have **exactly two
special edges** , modulo (10^9+7).
A simple cycle is a cycle of length at least 3, without repeated vertices or
edges. | [{"input": "3\n 2 3 1 4", "output": "121788\n \n\nThe following drawings show two valid cycles (but there are more!) with\nproducts 2 \\cdot 5 \\cdot 6 \\cdot 3 \\cdot 1 \\cdot 2 \\cdot 5 \\cdot 4 = 7200 and\n1 \\cdot 3 \\cdot 7 \\cdot 7 \\cdot 3 \\cdot 1 \\cdot 2 \\cdot 5 \\cdot 4 \\cdot 2 =\n35280. The third cycle is invalid because it doesn't have exactly two special\nedges.\n\n\n\n* * *"}, {"input": "2\n 1 2", "output": "36\n \n\nThe only simple cycle in the graph indeed has two special edges, and the\nproduct of vertices is 1 \\cdot 3 \\cdot 3 \\cdot 1 \\cdot 2 \\cdot 2 = 36.\n\n* * *"}, {"input": "5\n 6 14 15 7 12 16 5 4 11 9 3 10 8 2 13 1", "output": "10199246"}] |
Compute the sum of products of simple cycles that have exactly two special
edges. Print the answer modulo (10^9+7).
* * * | s644442003 | Runtime Error | p02591 | Input is given from Standard Input in the following format (where L =
2^{H-1}).
H
P_1 P_2 \cdots P_L | import os
import sys
import numpy as np
def solve(inp):
def mod_pow(x, a, MOD):
ret = 1
cur = x
while a:
if a & 1:
ret = ret * cur % MOD
cur = cur * cur % MOD
a >>= 1
return ret
h = inp[0]
ppp = inp[1:]
n = 1 << (h - 1)
ppp += n - 1
MOD = 10**9 + 7
cumprods = np.ones(2 * n, dtype=np.int64)
cumprods_rev = np.ones(n, dtype=np.int64)
cumprods_through = np.zeros(n, dtype=np.int64)
for i in range(2, 2 * n):
cumprods[i] = cumprods[i >> 1] * i % MOD
for i in range(n):
cumprods_rev[i] = mod_pow(cumprods[i], MOD - 2, MOD)
cumprods_through[i] = cumprods[i + n] * cumprods[ppp[i]] % MOD
cumprods_from_tree1 = np.zeros(2 * n, dtype=np.int64)
ans = 0
for lca in range(1, n):
d = lca
digit = h
while d:
d >>= 1
digit -= 1
leftmost_leaf_in_left_subtree = lca << digit
leftmost_leaf_in_right_subtree = ((lca << 1) + 1) << (digit - 1)
rightmost_leaf_in_right_subtree = (lca + 1) << digit
rev = cumprods_rev[lca >> 1]
for leaf in range(
leftmost_leaf_in_left_subtree, leftmost_leaf_in_right_subtree
):
v = ppp[leaf - n]
cp = cumprods_through[leaf - n] * rev % MOD
while v > 1:
cumprods_from_tree1[v] += cp * cumprods_rev[v >> 1] % MOD
v >>= 1
rev = cumprods_rev[lca]
for leaf in range(
leftmost_leaf_in_right_subtree, rightmost_leaf_in_right_subtree
):
v = ppp[leaf - n]
cp = cumprods_through[leaf - n] * rev % MOD
while v > 1:
ans += (
cumprods_from_tree1[v ^ 1]
% MOD
* cp
% MOD
* cumprods_rev[v >> 2]
% MOD
)
v >>= 1
ans %= MOD
for leaf in range(
leftmost_leaf_in_left_subtree, leftmost_leaf_in_right_subtree
):
v = ppp[leaf - n]
while cumprods_from_tree1[v] != 0:
cumprods_from_tree1[v] = 0
v >>= 1
return ans
if sys.argv[-1] == "ONLINE_JUDGE":
from numba.pycc import CC
cc = CC("my_module")
cc.export("solve", "(i8[:],)")(solve)
cc.compile()
exit()
if os.name == "posix":
# noinspection PyUnresolvedReferences
from my_module import solve
else:
from numba import njit
solve = njit("(i8[:],)", cache=True)(solve)
print("compiled", file=sys.stderr)
inp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=" ")
ans = solve(inp)
print(ans)
| Statement
Inspired by the tv series _Stranger Things_ , bear Limak is going for a walk
between two mirror worlds.
There are two perfect binary trees of height H, each with the standard
numeration of vertices from 1 to 2^H-1. The root is 1 and the children of x
are 2 \cdot x and 2 \cdot x + 1.
Let L denote the number of leaves in a single tree, L = 2^{H-1}.
You are given a permutation P_1, P_2, \ldots, P_L of numbers 1 through L. It
describes L _special_ edges that connect leaves of the two trees. There is a
special edge between vertex L+i-1 in the first tree and vertex L+P_i-1 in the
second tree.

_drawing for the first sample test, permutation P = (2, 3, 1, 4), special
edges in green_
Let's define _product_ of a cycle as the product of numbers in its vertices.
Compute the sum of products of all simple cycles that have **exactly two
special edges** , modulo (10^9+7).
A simple cycle is a cycle of length at least 3, without repeated vertices or
edges. | [{"input": "3\n 2 3 1 4", "output": "121788\n \n\nThe following drawings show two valid cycles (but there are more!) with\nproducts 2 \\cdot 5 \\cdot 6 \\cdot 3 \\cdot 1 \\cdot 2 \\cdot 5 \\cdot 4 = 7200 and\n1 \\cdot 3 \\cdot 7 \\cdot 7 \\cdot 3 \\cdot 1 \\cdot 2 \\cdot 5 \\cdot 4 \\cdot 2 =\n35280. The third cycle is invalid because it doesn't have exactly two special\nedges.\n\n\n\n* * *"}, {"input": "2\n 1 2", "output": "36\n \n\nThe only simple cycle in the graph indeed has two special edges, and the\nproduct of vertices is 1 \\cdot 3 \\cdot 3 \\cdot 1 \\cdot 2 \\cdot 2 = 36.\n\n* * *"}, {"input": "5\n 6 14 15 7 12 16 5 4 11 9 3 10 8 2 13 1", "output": "10199246"}] |
Print a_i and a_j that you selected, with a space in between.
* * * | s827545850 | Runtime Error | p03380 | Input is given from Standard Input in the following format:
n
a_1 a_2 ... a_n | N = int(input())
A = list(map(int, input().split()))
n = max(A)
A_sorted = sorted(A)
max_nCr = 0
r = 0
import bisect
index = bisect.bisect_left(A_sorted, n/2)
from operator import mul
from functools import reduce
def cmb(n, r):
r = min(n - r, r)
if r == 0: return 1
over = reduce(mul, range(n, n - r, -1))
under = reduce(mul, range(1, r + 1))
return over // under
# print(A_sorted[index], A_sorted[index-1:index+1])
min_diff = float('inf')
for a in A_sorted[index-1:index+1]:
if min_diff > abs(n/2 - a) and a != n:
r = a
print(n, r | Statement
Let {\rm comb}(n,r) be the number of ways to choose r objects from among n
objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n,
select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If
there are multiple pairs that maximize the value, any of them is accepted. | [{"input": "5\n 6 9 4 2 11", "output": "11 6\n \n\n\\rm{comb}(a_i,a_j) for each possible selection is as follows:\n\n * \\rm{comb}(4,2)=6\n * \\rm{comb}(6,2)=15\n * \\rm{comb}(6,4)=15\n * \\rm{comb}(9,2)=36\n * \\rm{comb}(9,4)=126\n * \\rm{comb}(9,6)=84\n * \\rm{comb}(11,2)=55\n * \\rm{comb}(11,4)=330\n * \\rm{comb}(11,6)=462\n * \\rm{comb}(11,9)=55\n\nThus, we should print 11 and 6.\n\n* * *"}, {"input": "2\n 100 0", "output": "100 0"}] |
Print a_i and a_j that you selected, with a space in between.
* * * | s943641613 | Accepted | p03380 | Input is given from Standard Input in the following format:
n
a_1 a_2 ... a_n | N = int(input())
A = list(map(int, input().split()))
sort_A = sorted(A)
max_A = sort_A[-1]
answer = []
half_A = max_A // 2
number = pow(10, 9)
answer = 0
for n in range(N - 1):
if number >= abs(sort_A[n] - half_A):
answer = n
number = abs(sort_A[n] - half_A)
print(max_A, sort_A[answer])
| Statement
Let {\rm comb}(n,r) be the number of ways to choose r objects from among n
objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n,
select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If
there are multiple pairs that maximize the value, any of them is accepted. | [{"input": "5\n 6 9 4 2 11", "output": "11 6\n \n\n\\rm{comb}(a_i,a_j) for each possible selection is as follows:\n\n * \\rm{comb}(4,2)=6\n * \\rm{comb}(6,2)=15\n * \\rm{comb}(6,4)=15\n * \\rm{comb}(9,2)=36\n * \\rm{comb}(9,4)=126\n * \\rm{comb}(9,6)=84\n * \\rm{comb}(11,2)=55\n * \\rm{comb}(11,4)=330\n * \\rm{comb}(11,6)=462\n * \\rm{comb}(11,9)=55\n\nThus, we should print 11 and 6.\n\n* * *"}, {"input": "2\n 100 0", "output": "100 0"}] |
Print a_i and a_j that you selected, with a space in between.
* * * | s374515551 | Accepted | p03380 | Input is given from Standard Input in the following format:
n
a_1 a_2 ... a_n | n, *a = map(int, open(0).read().split())
a = sorted(a)
l = max(a)
b = a
b = sorted(b, key=lambda t: abs(t - l / 2))
r = b[0]
print(l, r)
| Statement
Let {\rm comb}(n,r) be the number of ways to choose r objects from among n
objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n,
select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If
there are multiple pairs that maximize the value, any of them is accepted. | [{"input": "5\n 6 9 4 2 11", "output": "11 6\n \n\n\\rm{comb}(a_i,a_j) for each possible selection is as follows:\n\n * \\rm{comb}(4,2)=6\n * \\rm{comb}(6,2)=15\n * \\rm{comb}(6,4)=15\n * \\rm{comb}(9,2)=36\n * \\rm{comb}(9,4)=126\n * \\rm{comb}(9,6)=84\n * \\rm{comb}(11,2)=55\n * \\rm{comb}(11,4)=330\n * \\rm{comb}(11,6)=462\n * \\rm{comb}(11,9)=55\n\nThus, we should print 11 and 6.\n\n* * *"}, {"input": "2\n 100 0", "output": "100 0"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.