結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
![]() |
提出日時 | 2016-03-12 01:44:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 397 ms / 2,000 ms |
コード長 | 1,383 bytes |
コンパイル時間 | 828 ms |
コンパイル使用メモリ | 86,916 KB |
実行使用メモリ | 44,372 KB |
最終ジャッジ日時 | 2024-09-25 02:43:49 |
合計ジャッジ時間 | 5,864 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include <iostream> #include <sstream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <ctime> #include <vector> #include <string> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <functional> #include <algorithm> using namespace std; #define rep(i,j) REP((i), 0, (j)) #define REP(i,j,k) for(int i=(j);(i)<(k);++i) #define BW(a,x,b) ((a)<=(x)&&(x)<=(b)) #define ALL(v) (v).begin(), (v).end() #define LENGTHOF(x) (sizeof(x) / sizeof(*(x))) #define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b) #define SQ(x) ((x)*(x)) #define Mod(x, mod) (((x)+(mod)%(mod)) #define MP make_pair #define PB push_back #define Fi first #define Se second #define INF (1<<29) #define EPS 1e-10 #define MOD 1000000007 typedef pair<int, int> pi; typedef pair<int, pi> pii; typedef vector<int> vi; typedef queue<int> qi; typedef long long ll; int H, W; int N; vector<pair<string, int> >SK; int main() { cin >> H >> W; cin >> N; rep(i, N){ string s; int k; cin >> s >> k; SK.push_back(make_pair(s, k)); } int x = 0, y = 0; for(int i=N-1;i>=0;i--){ if(SK[i].first == "C"){ if(x == SK[i].second){ y--; if(y < 0) y = H-1; } }else{ if(y == SK[i].second){ x--; if(x < 0) x = W-1; } } } if((x+y)&1) cout << "black\n"; else cout << "white\n"; return 0; }