結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
|
提出日時 | 2018-05-21 18:04:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 325 ms / 2,000 ms |
コード長 | 689 bytes |
コンパイル時間 | 606 ms |
コンパイル使用メモリ | 72,192 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-06-28 15:29:36 |
合計ジャッジ時間 | 5,986 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include<iostream> #include<stack> using namespace std; int main(){ int h, w, n; cin >> h >> w >> n; char c; int s; stack<pair<char,int>> manip; for(int i = 0; i < n; i++){ cin >> c >> s; manip.push({c,s}); } int x = 0, y = 0; while(!manip.empty()){ pair<char,int> p = manip.top(); manip.pop(); if(p.first == 'R' && x == p.second){ y--; if(y < 0) y = w-1; }else if(p.first == 'C' && y == p.second){ x--; if(x < 0) x = h-1; } } if((x+y)%2 == 0) cout << "white" << endl; else cout << "black" << endl; return 0; }