結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
|
提出日時 | 2017-07-08 11:29:51 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 711 bytes |
コンパイル時間 | 606 ms |
コンパイル使用メモリ | 73,864 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-06 19:38:57 |
合計ジャッジ時間 | 4,144 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 8 RE * 9 |
ソースコード
#include<cstdio> #include<iostream> #include<algorithm> #include<string> #include<queue> #include<vector> #include<functional> #include<cmath> #include<map> #include<stack> #include<set> #include<numeric> using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef pair<ll, ll> pl; char s[100010]; int k[100010]; int main() { ll H,W,N; cin >> H >> W >> N; for (int i = 0; i < N; i++) cin >> s[i] >> k[i]; int r = 0, c = 0; for (int i =N-1; i >= 0; i--) { if (s[i] == 'R' && k[i] == r) { c = (c + W - 1) % W; }else if(s[i] == 'C' && k[i] == c){ r = (r + H - 1) % H; } } if ((r + c) % 2 == 0) cout << "white" << endl; else cout << "black" << endl; return 0; }