結果

問題 No.351 市松スライドパズル
ユーザー Bantako
提出日時 2018-07-10 20:11:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 636 bytes
コンパイル時間 1,543 ms
コンパイル使用メモリ 170,984 KB
実行使用メモリ 8,264 KB
最終ジャッジ日時 2024-09-13 19:26:42
合計ジャッジ時間 7,039 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    ll H,W,N;
    cin >> H >> W >> N;
    vector<int> V(N);
    vector<char> C(N);
    rep(i,0,N){
        cin >> C[i] >> V[i];
    }
    int y = 0,x = 0;
    for(int i = N-1;i >= 0;i--){
        if(V[i] == x || V[i] == y){
            if(C[i] == 'R')x = (x + W - 1) % W;
            else           y = (y + H - 1) % H;
        }
    }
    //cout << x << " " << y << endl;
    if((x + y) & 1)cout << "black" << endl;
    else           cout << "white" << endl;
    
}
0