結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
data9824
|
| 提出日時 | 2016-04-07 02:05:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 363 ms / 2,000 ms |
| コード長 | 678 bytes |
| コンパイル時間 | 585 ms |
| コンパイル使用メモリ | 62,324 KB |
| 実行使用メモリ | 11,600 KB |
| 最終ジャッジ日時 | 2024-09-25 03:00:36 |
| 合計ジャッジ時間 | 5,182 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <utility>
using namespace std;
int main() {
int h, w, n;
cin >> h >> w >> n;
vector<pair<char, int> > operations;
for (int i = 0; i < n; ++i) {
string s;
int k;
cin >> s >> k;
operations.push_back(make_pair(s[0], k));
}
int x = 0;
int y = 0;
for (int i = operations.size() - 1; i >= 0; --i) {
if (operations[i].first == 'R') {
if (operations[i].second == y) {
--x;
if (x < 0) {
x = w - 1;
}
}
} else {
if (operations[i].second == x) {
--y;
if (y < 0) {
y = h - 1;
}
}
}
}
cout << ((x + y) % 2 == 0 ? "white" : "black") << endl;
return 0;
}
data9824