結果
問題 | No.351 市松スライドパズル |
ユーザー |
![]() |
提出日時 | 2016-03-24 02:33:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 165 ms / 2,000 ms |
コード長 | 603 bytes |
コンパイル時間 | 1,521 ms |
コンパイル使用メモリ | 162,264 KB |
実行使用メモリ | 38,400 KB |
最終ジャッジ日時 | 2024-09-25 02:58:34 |
合計ジャッジ時間 | 4,196 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; struct INIT{INIT(){ios::sync_with_stdio(false);cin.tie(0);}}init; int main() { int r=0,c=0,R,C,N; cin>>R>>C>>N; vector<string> S(N); vector<int> K(N); for(int i = 0; i < N; i++)cin>>S[i]>>K[i]; reverse(S.begin(),S.end()); reverse(K.begin(),K.end()); for(int i = 0; i < N; i++) if(S[i]=="R"){ if(r==K[i]) c=(c+C-1)%C; } else{ if(c==K[i]) r=(r+R-1)%R; } if((r+c)&1)cout<<"black"<<endl; else cout<<"white"<<endl; return 0; }