結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2016-03-27 22:56:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 695 ms / 2,000 ms |
| コード長 | 1,318 bytes |
| コンパイル時間 | 642 ms |
| コンパイル使用メモリ | 78,676 KB |
| 実行使用メモリ | 402,220 KB |
| 最終ジャッジ日時 | 2024-09-25 02:58:46 |
| 合計ジャッジ時間 | 8,135 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <limits.h>
#include <time.h>
#include <string>
#include <string.h>
#include <sstream>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <queue>
using namespace std;
typedef long long ll;
const int WHITE = 0;
const int BLACK = 1;
int main(){
int h, w;
cin >> h >> w;
int n;
cin >> n;
int field[h][w];
int val = WHITE;
for(int y = 0; y < h; y++){
int num = val;
for(int x = 0; x < w; x++){
field[y][x] = num;
num ^= 1;
}
val ^= 1;
}
char s;
int k;
vector<pair<char, int> > query;
for(int i = 0; i < n; i++){
cin >> s >> k;
query.push_back(pair<char,int>(s,k));
}
reverse(query.begin(), query.end());
int curY = 0;
int curX = 0;
for(int i = 0; i < n; i++){
pair<char, int> q = query[i];
if (q.first == 'R'){
if (q.second == curY){
if (curX == 0){
curX = w-1;
}else{
curX--;
}
}
}else{
if (q.second == curX){
if (curY == 0){
curY = h-1;
}else{
curY--;
}
}
}
}
if(field[curY][curX] == WHITE){
cout << "white" << endl;
}else{
cout << "black" << endl;
}
return 0;
}
siman