結果
問題 | No.351 市松スライドパズル |
ユーザー | masa |
提出日時 | 2016-03-11 23:50:58 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 319 ms / 2,000 ms |
コード長 | 486 bytes |
コンパイル時間 | 571 ms |
コンパイル使用メモリ | 60,708 KB |
実行使用メモリ | 8,084 KB |
最終ジャッジ日時 | 2024-09-25 02:37:56 |
合計ジャッジ時間 | 4,917 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include <iostream> #include <cstdio> #include <vector> using namespace std; int main() { int h, w, n; cin >> h >> w >> n; vector<char> s(n); vector<int> k(n); for (int i = 0; i < n; i++) { cin >> s[i] >> k[i]; } int x = 0; int y = 0; for (int i = n - 1; i >= 0; i--) { if (s[i] == 'R' && k[i] == y) { x = (x - 1 + w) % w; } else if (s[i] == 'C' && k[i] == x) { y = (y - 1 + h) % h; } } cout << ((x + y) % 2 == 0 ? "white" : "black") << endl; return 0; }