結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
RIGIH
|
| 提出日時 | 2017-07-26 01:47:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 325 ms / 2,000 ms |
| コード長 | 798 bytes |
| コンパイル時間 | 705 ms |
| コンパイル使用メモリ | 64,760 KB |
| 実行使用メモリ | 8,320 KB |
| 最終ジャッジ日時 | 2024-10-09 17:29:37 |
| 合計ジャッジ時間 | 6,170 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define LL long long
#define mass 1000000007
using namespace std;
int keta(int n,int k){return (n/int(pow(10,double(k-1)))) % 10;} //nの下からk桁目
int main(){
int h,w,n;
cin>>h>>w;
cin>>n;
char *s;
int *k;
s=new char[n];
k=new int[n];
rep(i,n){
cin>>s[i]>>k[i];
}
int h1=0,w1=0;
for(int i=n-1;i>=0;i--){
if(s[i]=='R'){
if(k[i]==h1){
w1--;
if(w1==-1){
w1=w-1;
}
}
}else{
if(k[i]==w1){
h1--;
if(h1==-1){
h1=h-1;
}
}
}
}
if((h1-w1)%2==0){
cout<<"white"<<endl;
}else{
cout<<"black"<<endl;
}
return 0;
}
RIGIH