結果
問題 | No.351 市松スライドパズル |
ユーザー |
![]() |
提出日時 | 2016-08-20 18:58:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 99 ms / 2,000 ms |
コード長 | 660 bytes |
コンパイル時間 | 669 ms |
コンパイル使用メモリ | 77,460 KB |
実行使用メモリ | 8,412 KB |
最終ジャッジ日時 | 2024-09-25 03:03:53 |
合計ジャッジ時間 | 2,782 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include <iostream> #include <fstream> #include <vector> #include <cstring> #include <string> #include <algorithm> #include <iomanip> using namespace std; char S[1000000]; int K[1000000]; int main() { cin.tie(0); ios::sync_with_stdio(false); int H, W, N; cin >> H >> W >> N; for(int i = 0; i < N; i++) { cin >> S[i] >> K[i]; } reverse(S, S + N); reverse(K, K + N); int x = 0, y = 0; for(int i = 0; i < N; i++) { if(S[i] == 'R') { if(K[i] == y) { x = (x - 1 + W) % W; } } else { if(K[i] == x) { y = (y - 1 + H) % H; } } } if((x + y) % 2 == 0) { cout << "white" << endl; } else { cout << "black" << endl; } }