結果

問題 No.1149 色塗りゲーム
ユーザー ooaiu
提出日時 2025-07-10 02:21:04
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 3,126 ms
コンパイル使用メモリ 274,592 KB
実行使用メモリ 26,224 KB
平均クエリ数 19.88
最終ジャッジ日時 2025-07-10 02:21:15
合計ジャッジ時間 10,359 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N;
int paint(int k, int x) {
	assert(1<= k && k <= 2 && 1 <= x && x <= N + 1 - k);
	cout << k << " " << x << endl;
	int t;
	cin >> t;
	return t;
}
int main() {
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	cin >> N;
	int t = (N & 1 ? paint(1, (N+1)/2) : paint(2, N/2));
	if(t<=1) exit(0);
	int M = (N & 1 ? N/2+1 : (N-2)/2+2);
	while(true) {
		int k, x;
		cin >> k >> x;
		if(x >= M) x -= M;
		else x += M;
		int t = paint(k, x);
		if(t <= 1) exit(0);
	}
}

0