結果

問題 No.351 市松スライドパズル
ユーザー kotamanegikotamanegi
提出日時 2016-03-11 23:28:50
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 398 ms / 2,000 ms
コード長 1,146 bytes
コンパイル時間 793 ms
コンパイル使用メモリ 90,236 KB
実行使用メモリ 44,500 KB
最終ジャッジ日時 2024-09-25 02:37:40
合計ジャッジ時間 5,767 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |         scanf("%d%d", &h, &w);
      |         ~~~~~^~~~~~~~~~~~~~~~
main.cpp:28:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <list>
#include <typeinfo>
using namespace std;
#define REP(a,b) for(long long a = 0;a < b;++a)
vector<pair<string, int>> queryes;
int main() {
	int h, w;
	scanf("%d%d", &h, &w);
	int n;
	scanf("%d", &n);
	double ans = 0;
	for (int cnt = 0;cnt < n;++cnt) {
		string s;
		int i;
		cin >> s >> i;
		queryes.push_back(pair<string, int>(s, i));
	}
	int x_now = 0;
	int y_now = 0;
	for (int cnt = n - 1;cnt >= 0;--cnt) {
		if (queryes[cnt].first == "R") {
			if (queryes[cnt].second == y_now) {
				x_now--;
				if (x_now < 0) x_now = w-1;
			}
		}
		else {
			if (queryes[cnt].second == x_now) {
				y_now--;
				if (y_now < 0) y_now = h-1;
			}
		}
	}
	if ((x_now + y_now) % 2 == 0) {
		cout << "white" << endl;
	}
	else {
		cout << "black" << endl;
	}
}
//thank you for reading my code!
0