AtCoder Grand Contest 016

Submission #1369417

Source codeソースコード

N = int(input())
a = [int(n) for n in input().split()]
up, lo = max(a), min(a)
if up > lo+1:
    print("No")
elif up == lo:
    if up == N-1 or N//2 >= up:
        print("Yes")
    else:
        print("No")
else:
    ulen = sum([n==up for n in a])
    llen = N - ulen
    colors_in_up = up - llen
    print("Yes" if colors_in_up > 0 and colors_in_up*2 <= ulen else "No")

Submission

Task問題 B - Colorful Hats
User nameユーザ名 htkb
Created time投稿日時
Language言語 Python3 (3.4.3)
Status状態 AC
Score得点 700
Source lengthソースコード長 384 Byte
File nameファイル名
Exec time実行時間 54 ms
Memory usageメモリ使用量 13964 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - 0_00.txt,0_01.txt,0_02.txt,0_03.txt,0_04.txt,0_05.txt
All 700 / 700 0_00.txt,0_01.txt,0_02.txt,0_03.txt,0_04.txt,0_05.txt,1_00.txt,1_01.txt,1_02.txt,1_03.txt,1_04.txt,1_05.txt,1_06.txt,1_07.txt,1_08.txt,1_09.txt,1_10.txt,1_11.txt,1_12.txt,1_13.txt,1_14.txt,1_15.txt,1_16.txt,1_17.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
0_00.txt AC 17 ms 3064 KB
0_01.txt AC 17 ms 3060 KB
0_02.txt AC 17 ms 3060 KB
0_03.txt AC 17 ms 3060 KB
0_04.txt AC 17 ms 3060 KB
0_05.txt AC 17 ms 3060 KB
1_00.txt AC 17 ms 3064 KB
1_01.txt AC 17 ms 3064 KB
1_02.txt AC 39 ms 4908 KB
1_03.txt AC 46 ms 13964 KB
1_04.txt AC 46 ms 13836 KB
1_05.txt AC 47 ms 13964 KB
1_06.txt AC 46 ms 13324 KB
1_07.txt AC 53 ms 13836 KB
1_08.txt AC 46 ms 4896 KB
1_09.txt AC 52 ms 13964 KB
1_10.txt AC 46 ms 4908 KB
1_11.txt AC 52 ms 13324 KB
1_12.txt AC 54 ms 13964 KB
1_13.txt AC 54 ms 13964 KB
1_14.txt AC 54 ms 13964 KB
1_15.txt AC 17 ms 3060 KB
1_16.txt AC 17 ms 3060 KB
1_17.txt AC 48 ms 13812 KB