結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 25 ms
24,120 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
権限があれば一括ダウンロードができます

ソースコード

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 minx = *min_element(ALL(x)), 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);
	assert(pred.size() >= 3);
	
	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]);
			assert(y == 0);
			assert(x < 2);
			if (x == 1) {
				ans[t] = i;
				done[t] = true;
				break;
			}
		}
	}
	
	query(ans[0], ans[1], ans[2], ans[3]);
}
0