結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
|
提出日時 | 2016-03-11 22:44:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 102 ms / 2,000 ms |
コード長 | 696 bytes |
コンパイル時間 | 475 ms |
コンパイル使用メモリ | 60,452 KB |
実行使用メモリ | 8,116 KB |
最終ジャッジ日時 | 2024-09-25 02:28:08 |
合計ジャッジ時間 | 2,508 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include <iostream> #include <vector> using namespace std; #define repeat(i,n) for (int i = 0; (i) < (n); ++(i)) #define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i)) int main() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); int h, w; cin >> h >> w; int n; cin >> n; vector<char> s(n); vector<int> k(n); repeat (i,n) cin >> s[i] >> k[i]; int y = 0, x = 0; repeat_reverse (i,n) { if (s[i] == 'R' and y == k[i]) { x = (x - 1 + w) % w; } else if (s[i] == 'C' and x == k[i]) { y = (y - 1 + h) % h; } } cout << (y % 2 == x % 2 ? "white" : "black") << endl; return 0; }