結果
問題 | No.351 市松スライドパズル |
ユーザー | むらため |
提出日時 | 2019-01-19 17:46:51 |
言語 | Nim (2.0.2) |
結果 |
AC
|
実行時間 | 44 ms / 2,000 ms |
コード長 | 869 bytes |
コンパイル時間 | 2,307 ms |
コンパイル使用メモリ | 66,796 KB |
実行使用メモリ | 5,008 KB |
最終ジャッジ日時 | 2023-09-14 02:18:54 |
合計ジャッジ時間 | 4,064 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 32 ms
4,968 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,384 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 1 ms
4,376 KB |
testcase_06 | AC | 2 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | AC | 2 ms
4,380 KB |
testcase_09 | AC | 2 ms
4,380 KB |
testcase_10 | AC | 1 ms
4,376 KB |
testcase_11 | AC | 2 ms
4,380 KB |
testcase_12 | AC | 1 ms
4,380 KB |
testcase_13 | AC | 43 ms
4,904 KB |
testcase_14 | AC | 43 ms
4,816 KB |
testcase_15 | AC | 44 ms
5,008 KB |
testcase_16 | AC | 43 ms
4,912 KB |
testcase_17 | AC | 33 ms
4,972 KB |
testcase_18 | AC | 32 ms
4,956 KB |
testcase_19 | AC | 42 ms
4,964 KB |
testcase_20 | AC | 42 ms
4,944 KB |
ソースコード
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .} proc scan(): int32 = while true: var k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord.int32 - '0'.ord.int32 let h = scan() let w = scan() let n = scan() var ops: array[1000010,int16] for i in 0..<n: let isC = getchar_unlocked() == 'C' discard getchar_unlocked() var k = cast[int16](0) while true: var c = getchar_unlocked() if c < '0': break k = cast[int16](10) * k + cast[int16](c) - cast[int16]('0') if isC : ops[i] = k+1 else: ops[i] = -k-1 var x = 0 var y = 0 for i in (n-1).countdown(0): var op = ops[i] let isC = op > 0 op = op.abs - 1 if isC: if x != op: continue y = (y - 1 + h) mod h else: if y != op: continue x = (x - 1 + w) mod w if (x mod 2) == (y mod 2) : echo "white" else:echo "black"