結果
問題 | No.351 市松スライドパズル |
ユーザー | mai |
提出日時 | 2016-03-11 23:25:42 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 325 ms / 2,000 ms |
コード長 | 807 bytes |
コンパイル時間 | 707 ms |
コンパイル使用メモリ | 71,368 KB |
実行使用メモリ | 11,504 KB |
最終ジャッジ日時 | 2023-10-25 07:18:08 |
合計ジャッジ時間 | 5,151 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 225 ms
11,504 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 1 ms
4,348 KB |
testcase_03 | AC | 2 ms
4,348 KB |
testcase_04 | AC | 1 ms
4,348 KB |
testcase_05 | AC | 1 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | AC | 1 ms
4,348 KB |
testcase_08 | AC | 2 ms
4,348 KB |
testcase_09 | AC | 1 ms
4,348 KB |
testcase_10 | AC | 2 ms
4,348 KB |
testcase_11 | AC | 2 ms
4,348 KB |
testcase_12 | AC | 2 ms
4,348 KB |
testcase_13 | AC | 315 ms
11,320 KB |
testcase_14 | AC | 318 ms
11,364 KB |
testcase_15 | AC | 325 ms
11,500 KB |
testcase_16 | AC | 324 ms
11,504 KB |
testcase_17 | AC | 319 ms
11,504 KB |
testcase_18 | AC | 318 ms
11,504 KB |
testcase_19 | AC | 322 ms
11,504 KB |
testcase_20 | AC | 325 ms
11,504 KB |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <cstdio> #include <cmath> #include <stack> using namespace std; typedef unsigned char byte; typedef long long int LLint; typedef unsigned long long int uLLint; class Twin{ public: int c,k; Twin(int a,int b):c(a),k(b){} }; int main(){ int h,w,n,k; char c; int i; int x,y; stack<Twin> stk; cin>>h>>w>>n; for (i=0;i<n;i++){ cin>>c>>k; stk.push(Twin((int)c,k)); } x=y=0; for (;!stk.empty();stk.pop()){ Twin &t=stk.top(); if (t.c=='R'){ if (y==t.k) x--; }else{ if (x==t.k) y--; } if (x<0) x=w-1; if (y<0) y=h-1; } cout<<( ((x&1)^(y&1))?"black":"white" )<<endl; return 0; }