結果
| 問題 | 
                            No.349 干支の置き物
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-01-16 18:15:51 | 
| 言語 | Nim  (2.2.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 368 bytes | 
| コンパイル時間 | 3,948 ms | 
| コンパイル使用メモリ | 74,468 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-01 06:31:08 | 
| 合計ジャッジ時間 | 5,010 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | WA * 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",0 else: quit "NO",0 while true: B = B.sorted(cmp) B[^1] -= 1 B[^2] -= 1 if B[^1] < 0 : quit "NO",0 if B[^2] == 0 and B[^1] <= 1 : quit "YES",0