結果

問題 No.351 市松スライドパズル
ユーザー HeyHey0111HeyHey0111
提出日時 2016-03-13 02:43:33
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 325 ms / 2,000 ms
コード長 735 bytes
コンパイル時間 620 ms
コンパイル使用メモリ 61,432 KB
実行使用メモリ 11,528 KB
最終ジャッジ日時 2023-10-25 07:37:28
合計ジャッジ時間 5,136 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 234 ms
11,528 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 317 ms
11,528 KB
testcase_14 AC 319 ms
11,528 KB
testcase_15 AC 324 ms
11,528 KB
testcase_16 AC 323 ms
11,528 KB
testcase_17 AC 321 ms
11,528 KB
testcase_18 AC 317 ms
11,528 KB
testcase_19 AC 323 ms
11,528 KB
testcase_20 AC 325 ms
11,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
typedef struct hoge{
    char c;
    int n;
    hoge(){
        c='a';
        n=0;
    }
    hoge(char c,int n):c(c),n(n){};
}hoge;
int main(void){
    int n,h,w;
    cin >> h >> w;
    cin >> n;
    vector<hoge> ho;
    
    for(int i=0;i<n;i++){
        int nn;
        char c;
        cin >> c >> nn;
        ho.push_back(hoge(c,nn));
        //cin >> ho[i].c >> ho[i].n;
    }
    int x=0,y=0;
    while(!ho.empty()){
        if(ho.back().c=='R'&&x==ho.back().n){
            y=(y+w-1)%w;
        }else if(ho.back().c=='C'&&y==ho.back().n){
            x=(x+h-1)%h;
        }
        ho.pop_back();
    }
    cout <<((x+y)%2  ? "black" : "white" )<<endl;
    return 0;
}
0