結果
| 問題 | No.351 市松スライドパズル |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-13 20:41:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 131 ms / 2,000 ms |
| コード長 | 982 bytes |
| 記録 | |
| コンパイル時間 | 1,472 ms |
| コンパイル使用メモリ | 157,724 KB |
| 実行使用メモリ | 8,504 KB |
| 最終ジャッジ日時 | 2024-09-25 02:56:49 |
| 合計ジャッジ時間 | 3,832 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:35:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
35 | scanf(" %c %d",&S[i],&K[i]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <list>
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define SQR(X) ( (X)*(X) )
#define CUBE(X) ( (X)*(X)*(X) )
// #define int ll
using namespace std;
bool test = 0;
/* ここからが本編 */
int main(){
int i,j,k,l;
int H,W;
int N;
static char S[1000002];
static int K[1000002];
cin >> H >> W;
cin >> N;
for(i=0;i<N;i++) {
scanf(" %c %d",&S[i],&K[i]);
}/*
rep(i,N) {
cout << S[i] << ' ' << K[i] << endl;
}*/
int x = 0,y = 0;
for(i=N-1;i>-1;i--) {
if(S[i] == 'R' && K[i] == y) {
if(x > 0) x--;
else x = W-1;
}
else if(S[i] == 'C' && K[i] == x){
if(y > 0) y--;
else y = H-1;
}
}
if((x+y) % 2) puts("black");
else puts("white");
return 0;
}