結果
問題 | No.351 市松スライドパズル |
ユーザー |
|
提出日時 | 2022-08-26 02:50:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 314 ms / 2,000 ms |
コード長 | 628 bytes |
コンパイル時間 | 1,625 ms |
コンパイル使用メモリ | 168,932 KB |
実行使用メモリ | 11,112 KB |
最終ジャッジ日時 | 2024-10-13 06:39:00 |
合計ジャッジ時間 | 6,613 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ int h, w, n; cin >> h >> w >> n; vector<pair<char,int>> a(n); for(int i = 0; i < n; i++)cin >> a[i].first >> a[i].second; reverse(a.begin(), a.end()); int y = 0, x = 0; for(int i = 0; i < n; i++){ if(a[i].first == 'R'){ if(y == a[i].second){ x--; if(x < 0)x += w; } }else{ if(x == a[i].second){ y--; if(y < 0)y += h; } } } cout << ((y ^ x) & 1 ? "black" : "white") << '\n'; }