結果
問題 | No.351 市松スライドパズル |
ユーザー |
![]() |
提出日時 | 2016-03-11 23:17:31 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 328 ms / 2,000 ms |
コード長 | 928 bytes |
コンパイル時間 | 770 ms |
コンパイル使用メモリ | 87,540 KB |
実行使用メモリ | 13,084 KB |
最終ジャッジ日時 | 2024-09-25 02:36:45 |
合計ジャッジ時間 | 5,054 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <iomanip> using namespace std; #define ll long long #define INF (1 << 30) #define INFLL (1LL << 60) int main() { int h,w,n; vector<pair<char,int> > move; cin >> h >> w >> n; char a; int b; for(int i = 0;i < n;i++){ cin >> a >> b; move.push_back(make_pair(a,b)); } pair<int,int> now; now = make_pair(0,0); for(int i = move.size()-1;i >= 0;i--){ char muki = move[i].first; int zahyo = move[i].second; int nx = now.first,ny = now.second; if(muki == 'R'){ if(ny == zahyo) nx--; if(nx < 0) nx = w-1; }else{ if(nx == zahyo) ny--; if(ny < 0) ny = h-1; } now = make_pair(nx,ny); } if((now.first + now.second) % 2 == 0) cout << "white" << endl; else cout << "black" << endl; return 0; }