結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
![]() |
提出日時 | 2018-09-05 13:35:51 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 110 ms / 2,000 ms |
コード長 | 906 bytes |
コンパイル時間 | 2,016 ms |
コンパイル使用メモリ | 157,548 KB |
実行使用メモリ | 8,192 KB |
最終ジャッジ日時 | 2024-11-08 19:02:54 |
合計ジャッジ時間 | 5,699 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include "bits/stdc++.h" using namespace std; #define ll long long int #define rep(i,n) for( int i = 0; i < n; i++ ) #define rrep(i,n) for( int i = n; i >= 0; i-- ) #define REP(i,s,t) for( int i = s; i <= t; i++ ) #define RREP(i,s,t) for( int i = s; i >= t; i-- ) #define dump(x) cerr << #x << " = " << (x) << endl; #define INF 2000000000 #define mod 1000000007 #define INF2 1000000000000000000 char S[1000010]; int R[1000010]; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int H, W; cin >> H >> W; int N; cin >> N; rep(i, N) { cin >> S[i] >> R[i]; } int x = 0, y = 0; RREP(i, N - 1, 0) { //cout << x << " " << y << endl; if (S[i] == 'R' && R[i] == y) { x--; } else if (S[i] == 'C' && R[i] == x) { y--; } x = (x + W) % W; y = (y + H) % H; } if ((x + y) % 2 == 0) { cout << "white" << endl; } else { cout << "black" << endl; } return 0; }