結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-14 00:20:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 107 ms / 2,000 ms |
| コード長 | 576 bytes |
| コンパイル時間 | 1,839 ms |
| コンパイル使用メモリ | 197,924 KB |
| 最終ジャッジ日時 | 2025-02-24 08:20:15 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int H,W,N;
cin>>H>>W>>N;
stack<pair<char,int>> S;
for(int i=0;i<N;i++){
char C;
int K;
cin>>C>>K;
S.push({C,K});
}
int y=0,x=0;
while(!S.empty()){
auto [C,K]=S.top();
S.pop();
if(C=='R'&&y==K){
x=(x-1+W)%W;
}
else if(C=='C'&&x==K){
y=(y-1+H)%H;
}
}
cout<<((y+x)%2?"black":"white")<<endl;
}