結果

問題 No.351 市松スライドパズル
ユーザー hotpepsi
提出日時 2016-03-17 00:37:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 661 bytes
コンパイル時間 735 ms
コンパイル使用メモリ 56,440 KB
実行使用メモリ 106,240 KB
最終ジャッジ日時 2024-10-01 08:49:30
合計ジャッジ時間 4,899 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 9 TLE * 1 -- * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d %d", &H, &W);
      |         ~~~~~^~~~~~~~~~~~~~~~~
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%d", &N);
      |         ~~~~~^~~~~~~~~~
main.cpp:22:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |                 scanf("%s %d", S, &K);
      |                 ~~~~~^~~~~~~~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <cstring>

using namespace std;

char b[10000][10000];

int main(int argc, char *argv[])
{
	int H, W, N;
	scanf("%d %d", &H, &W);
	scanf("%d", &N);
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			b[i][j] = (i + j) % 2;
		}
	}
	for (int i = 0; i < N; ++i) {
		char S[64];
		int K;
		scanf("%s %d", S, &K);
		if (S[0] == 'C') {
			char c = b[H - 1][K];
			for (int j = 1; j < H; ++j) {
				b[j][K] = b[j - 1][K];
			}
			b[0][K] = c;
		} else {
			char c = b[K][W - 1];
			memmove(&(b[K][1]), &(b[K][0]), W - 1);
			b[K][0] = c;
		}
	}
	cout << (b[0][0] ? "black" : "white") << endl;
	return 0;
}
0