結果
問題 | No.24 数当てゲーム |
ユーザー | mkanenobu |
提出日時 | 2018-03-29 22:47:10 |
言語 | Nim (2.0.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 966 bytes |
コンパイル時間 | 3,471 ms |
コンパイル使用メモリ | 71,432 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-12 17:56:28 |
合計ジャッジ時間 | 4,151 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | AC | 2 ms
4,380 KB |
testcase_09 | AC | 1 ms
4,376 KB |
コンパイルメッセージ
/home/judge/data/code/Main.nim(12, 11) Warning: Deprecated since v0.20, use 'initHashSet'; initSet is deprecated [Deprecated]
ソースコード
import sequtils, strutils, sets var n = readLine(stdin).parseInt a = newSeq[string](n) b = newSeq[string](n) c = newSeq[string](n) d = newSeq[string](n) r = newSeq[string](n) nots:seq[seq[int]] = @[] guess:seq[seq[int]] = @[] ans = initSet[int]() for i in 0..9: ans.incl(i) for i in 0..<n: (a[i],b[i],c[i],d[i],r[i]) = (readLine(stdin).split) for j in 0..<n: if r[j] == "NO": nots.add(@[a[j], b[j], c[j], d[j]].map(parseInt)) elif r[j] == "YES": guess.add(@[a[j], b[j], c[j], d[j]].map(parseInt)) proc main() = var yes,no:int for i in 0..<n: if r[i] == "YES": for j in 0..9: if not contains(guess[yes], j): ans.excl(j) yes += 1 elif r[i] == "NO": for j in 0..9: if contains(nots[no], j): ans.excl(j) no += 1 for i in ans: echo i main()