結果

問題 No.349 干支の置き物
ユーザー ABKZABKZ
提出日時 2023-02-07 22:31:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 384 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 71,940 KB
最終ジャッジ日時 2023-09-19 03:56:32
合計ジャッジ時間 5,520 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,636 KB
testcase_01 AC 93 ms
71,652 KB
testcase_02 AC 97 ms
71,752 KB
testcase_03 AC 92 ms
71,488 KB
testcase_04 WA -
testcase_05 AC 91 ms
71,876 KB
testcase_06 AC 93 ms
71,656 KB
testcase_07 AC 95 ms
71,472 KB
testcase_08 AC 99 ms
71,760 KB
testcase_09 AC 100 ms
71,680 KB
testcase_10 AC 93 ms
71,476 KB
testcase_11 AC 96 ms
71,748 KB
testcase_12 WA -
testcase_13 AC 94 ms
71,632 KB
testcase_14 AC 95 ms
71,480 KB
testcase_15 AC 106 ms
71,660 KB
testcase_16 AC 97 ms
71,832 KB
testcase_17 AC 95 ms
71,444 KB
testcase_18 AC 94 ms
71,860 KB
testcase_19 AC 102 ms
71,616 KB
testcase_20 AC 104 ms
71,672 KB
testcase_21 AC 104 ms
71,472 KB
testcase_22 AC 96 ms
71,656 KB
testcase_23 AC 94 ms
71,712 KB
testcase_24 AC 93 ms
71,652 KB
testcase_25 AC 93 ms
71,940 KB
testcase_26 AC 94 ms
71,480 KB
testcase_27 AC 93 ms
71,732 KB
testcase_28 AC 93 ms
71,712 KB
testcase_29 AC 92 ms
71,860 KB
testcase_30 AC 91 ms
71,648 KB
testcase_31 AC 94 ms
71,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections

N = int(input())
A = [input() for _ in range(N)]


_, cnts = zip(*collections.Counter(A).most_common())

if len(cnts) == 1:
    if cnts[0] == 1:
        print("YES")
    else:
        print("NO")
else:
    wk = 0
    for x in reversed(cnts):
        if wk != 0 and wk+1 < x:
            print("NO")
            break
        wk += x
    else:
        print("YES")
0