結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
Tawara
|
| 提出日時 | 2016-03-11 23:05:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 400 ms / 2,000 ms |
| コード長 | 975 bytes |
| コンパイル時間 | 666 ms |
| コンパイル使用メモリ | 79,008 KB |
| 実行使用メモリ | 43,536 KB |
| 最終ジャッジ日時 | 2024-09-25 02:32:56 |
| 合計ジャッジ時間 | 5,820 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:33:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
33 | scanf("%d %d",&H,&W);
| ~~~~~^~~~~~~~~~~~~~~
main.cpp:34:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
34 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
ソースコード
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef vector <int> VI;
typedef vector <VI> VVI;
typedef vector <string> VS;
typedef pair<int,int> PII;
typedef long long LL;
typedef vector <LL> VLL;
typedef unsigned long long ULL;
typedef pair <int, LL> PIL;
typedef vector <PIL> VPIL;
#define range(i,a,b) for(int i=(a); i < (b); i++)
#define rep(i,n) range(i,0,n)
int main(){
int H,W,N,k,hx=0,hy=0;
string s;
vector <string> S;
vector <int> K;
scanf("%d %d",&H,&W);
scanf("%d",&N);
rep(i,N){
cin >> s; S.push_back(s);
cin >> k; K.push_back(k);
}
for(int i = N-1; i>=0; i--){
if (S[i] == "R"){
if (K[i] == hy) hx = (hx - 1 + W) % W;
} else {
if (K[i] == hx) hy = (hy - 1 + H) % H;
}
}
if ((hx + hy) % 2 == 0){
printf("white\n");
}else{
printf("black\n");
}
return 0;
}
Tawara