結果
| 問題 | No.349 干支の置き物 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-23 21:03:22 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 35 ms / 2,000 ms |
| + 544µs | |
| コード長 | 501 bytes |
| 記録 | |
| コンパイル時間 | 94 ms |
| コンパイル使用メモリ | 64,608 KB |
| 実行使用メモリ | 53,736 KB |
| 最終ジャッジ日時 | 2026-10-15 13:09:57 |
| 合計ジャッジ時間 | 3,247 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 |
ソースコード
N = int(input())
cnt = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
eto = ["ne", "ushi", "tora", "u", "tatsu", "mi", "uma", "hitsuji", "saru", "tori", "inu", "i"]
for i in range(N):
cnt[eto.index(input())] += 1
before = -1
for i in range(N):
maxcnt = 0
oku = -1
for j in range(12):
if cnt[j] > maxcnt and before != j:
maxcnt = cnt[j]
oku = j
if oku == -1 and max(cnt) != 0:
print("NO")
exit()
before = oku
cnt[oku] -= 1
print("YES")