結果
問題 |
No.349 干支の置き物
|
ユーザー |
|
提出日時 | 2019-01-16 18:15:32 |
言語 | Nim (2.2.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 360 bytes |
コンパイル時間 | 3,935 ms |
コンパイル使用メモリ | 74,516 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-01 06:30:29 |
合計ジャッジ時間 | 4,908 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 29 |
ソースコード
import sequtils,strutils,algorithm,tables let n = stdin.readLine().parseInt() var B = toSeq(newSeqWith(n,stdin.readLine()).sorted(cmp).toCountTable().values).sorted(cmp) if B.len == 1 : if B[0] <= 1 : quit "YES" else: quit "NO" while true: B = B.sorted(cmp) B[^1] -= 1 B[^2] -= 1 if B[^1] < 0 : quit "NO" if B[^2] == 0 and B[^1] <= 1 : quit "YES"