結果
| 問題 | No.355 数当てゲーム(2) | 
| コンテスト | |
| ユーザー |  tkmst201 | 
| 提出日時 | 2021-02-24 21:35:05 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,539 bytes | 
| コンパイル時間 | 1,923 ms | 
| コンパイル使用メモリ | 195,968 KB | 
| 最終ジャッジ日時 | 2025-01-19 04:19:34 | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 37 WA * 15 | 
コンパイルメッセージ
main.cpp: In lambda function:
main.cpp:21:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |                 scanf("%d %d", &X, &Y);
      |                 ~~~~~^~~~~~~~~~~~~~~~~
            
            ソースコード
#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]);
}
            
            
            
        