結果

問題 No.355 数当てゲーム(2)
ユーザー tkmst201tkmst201
提出日時 2021-02-24 21:35:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,539 bytes
コンパイル時間 2,384 ms
コンパイル使用メモリ 202,844 KB
実行使用メモリ 24,312 KB
平均クエリ数 20.52
最終ジャッジ日時 2023-09-24 09:48:27
合計ジャッジ時間 7,842 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
23,640 KB
testcase_01 AC 25 ms
24,264 KB
testcase_02 AC 24 ms
23,400 KB
testcase_03 AC 23 ms
23,280 KB
testcase_04 WA -
testcase_05 AC 23 ms
23,292 KB
testcase_06 WA -
testcase_07 AC 24 ms
23,376 KB
testcase_08 AC 25 ms
24,120 KB
testcase_09 WA -
testcase_10 AC 25 ms
24,132 KB
testcase_11 AC 24 ms
23,448 KB
testcase_12 AC 25 ms
23,616 KB
testcase_13 AC 25 ms
23,988 KB
testcase_14 AC 25 ms
23,568 KB
testcase_15 AC 26 ms
23,424 KB
testcase_16 AC 25 ms
24,000 KB
testcase_17 AC 25 ms
24,096 KB
testcase_18 AC 25 ms
23,616 KB
testcase_19 WA -
testcase_20 AC 23 ms
23,688 KB
testcase_21 AC 24 ms
23,292 KB
testcase_22 AC 25 ms
23,796 KB
testcase_23 AC 24 ms
23,976 KB
testcase_24 AC 25 ms
23,676 KB
testcase_25 AC 25 ms
24,024 KB
testcase_26 AC 23 ms
23,508 KB
testcase_27 AC 25 ms
23,424 KB
testcase_28 WA -
testcase_29 AC 24 ms
23,556 KB
testcase_30 WA -
testcase_31 AC 25 ms
23,556 KB
testcase_32 AC 25 ms
23,688 KB
testcase_33 AC 26 ms
23,424 KB
testcase_34 WA -
testcase_35 AC 24 ms
23,988 KB
testcase_36 AC 24 ms
24,132 KB
testcase_37 AC 24 ms
23,268 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 24 ms
23,364 KB
testcase_41 WA -
testcase_42 AC 24 ms
23,280 KB
testcase_43 AC 23 ms
23,568 KB
testcase_44 AC 24 ms
23,292 KB
testcase_45 AC 23 ms
23,808 KB
testcase_46 WA -
testcase_47 AC 23 ms
24,096 KB
testcase_48 AC 23 ms
23,544 KB
testcase_49 AC 24 ms
23,436 KB
testcase_50 WA -
testcase_51 AC 23 ms
23,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = false;
//---------------------------------//

int main() {
	auto query = [](int a, int b, int c, int d) -> pii {
		printf("%d %d %d %d\n", a, b, c, d);
		fflush(stdout);
		int X, Y;
		scanf("%d %d", &X, &Y);
		if (X == 4 && Y == 0) exit(0);
		return {X, Y};
	};
	
	vector<int> x, y;
	FOR(i, 3, 10) {
		auto [X, Y] = query(0, 1, 2, i);
		x.emplace_back(X);
		y.emplace_back(Y);
	}
	int maxx = *max_element(ALL(x)), minx = *min_element(ALL(x));
	int maxy = *max_element(ALL(y)), miny = *min_element(ALL(y));
	vector<int> pred;
	FOR(i, 3, 10) if (x[i - 3] == minx && y[i - 3] == miny) pred.emplace_back(i);
	
	int ans[4];
	bool done[10] {};
	REP(i, pred.size()) done[pred[i]] = true;
	REP(t, 4) {
		int N[4];
		REP(i, 4) if (t != i) N[i] = pred[i - (i > t)];
		REP(i, 10)  {
			if (done[i]) continue;
			N[t] = i;
			auto [x, y] = query(N[0], N[1], N[2], N[3]);
			if (x == 1) {
				ans[t] = i;
				done[t] = true;
				break;
			}
		}
	}
	
	query(ans[0], ans[1], ans[2], ans[3]);
}
0