結果
問題 | No.351 市松スライドパズル |
ユーザー |
|
提出日時 | 2016-11-28 14:41:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 379 ms / 2,000 ms |
コード長 | 622 bytes |
コンパイル時間 | 1,795 ms |
コンパイル使用メモリ | 171,244 KB |
実行使用メモリ | 42,364 KB |
最終ジャッジ日時 | 2024-09-25 03:05:09 |
合計ジャッジ時間 | 6,734 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; const string msg[] = { "white", "black" }; signed main(){ int H, W; cin >> H >> W; int N; cin >> N; vector< pair< string, int > > opx( N ); for( int i = 0; i < N; ++i ) cin >> opx[ i ].first >> opx[ i ].second; int x = 0, y = 0; for( int i = N - 1; i >= 0; --i ){ string op = opx[ i ].first; int v = opx[ i ].second; if( op[ 0 ] == 'R' ){ if( x != v ) continue; y = ( y - 1 + W ) % W; } else{ if( y != v ) continue; x = ( x - 1 + H ) % H; } } cout << msg[ ( ( x & 1 ) + ( y & 1 ) ) & 1 ] << endl; return 0; }