結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
![]() |
提出日時 | 2025-03-14 16:15:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 401 ms / 2,000 ms |
コード長 | 1,259 bytes |
コンパイル時間 | 2,470 ms |
コンパイル使用メモリ | 196,344 KB |
実行使用メモリ | 42,236 KB |
最終ジャッジ日時 | 2025-03-14 16:15:24 |
合計ジャッジ時間 | 8,768 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; inline int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } inline void print(int x){ static int s[20],t=0; do s[++t]=x%10,x/=10;while(x); while(t) putchar(s[t--] + '0'); } struct node{ string s; int k; }; signed main(){ // int T; // freopen("puzzle.in","r",stdin); // freopen("puzzle.out","w",stdout); // T=read(); // whike(T--){ int h,w,n; pair<int,int> nw={0,0}; cin>>h>>w>>n; vector<node> Q(n); for(int i=0;i<n;i++){ cin>>Q[i].s>>Q[i].k; } for(int i=n-1;i>=0;i--){ if(Q[i].s=="R"){ if(nw.second==Q[i].k){ nw.first=(nw.first-1+w)%w; } }else{ if(nw.first==Q[i].k){ nw.second=(nw.second-1+h)%h; } } } cout<<((nw.first+nw.second)%2?"black\n":"white\n"); // } return 0; } // ????????????????????????? // ?????????????????? // ???????????????????????????????????? // ??????????????????????????????? // ???????????? // ???????????? // ???????????? // ???????????????????? // ???????????????????? // ???????????????????????????????? // ??????????????????????? // ??????????? // ?????????????