結果

問題 No.355 数当てゲーム(2)
ユーザー tkmst201tkmst201
提出日時 2017-04-20 22:31:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 1,356 bytes
コンパイル時間 1,076 ms
コンパイル使用メモリ 147,952 KB
実行使用メモリ 24,360 KB
平均クエリ数 29.06
最終ジャッジ日時 2023-09-24 01:00:04
合計ジャッジ時間 4,524 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,144 KB
testcase_01 AC 19 ms
24,060 KB
testcase_02 AC 20 ms
23,616 KB
testcase_03 AC 21 ms
24,024 KB
testcase_04 AC 21 ms
23,964 KB
testcase_05 AC 22 ms
23,316 KB
testcase_06 AC 24 ms
23,736 KB
testcase_07 AC 22 ms
24,360 KB
testcase_08 AC 21 ms
23,556 KB
testcase_09 AC 21 ms
23,316 KB
testcase_10 AC 21 ms
23,316 KB
testcase_11 AC 21 ms
23,964 KB
testcase_12 AC 25 ms
23,952 KB
testcase_13 AC 21 ms
23,664 KB
testcase_14 AC 22 ms
23,412 KB
testcase_15 AC 21 ms
23,952 KB
testcase_16 AC 21 ms
24,060 KB
testcase_17 AC 21 ms
24,300 KB
testcase_18 AC 20 ms
23,592 KB
testcase_19 AC 21 ms
23,964 KB
testcase_20 AC 21 ms
23,544 KB
testcase_21 AC 22 ms
23,868 KB
testcase_22 AC 21 ms
24,312 KB
testcase_23 AC 21 ms
23,328 KB
testcase_24 AC 20 ms
24,036 KB
testcase_25 AC 21 ms
23,316 KB
testcase_26 AC 21 ms
23,748 KB
testcase_27 AC 22 ms
23,292 KB
testcase_28 AC 20 ms
23,580 KB
testcase_29 AC 21 ms
23,448 KB
testcase_30 AC 24 ms
23,868 KB
testcase_31 AC 22 ms
23,676 KB
testcase_32 AC 20 ms
24,336 KB
testcase_33 AC 20 ms
23,904 KB
testcase_34 AC 21 ms
23,592 KB
testcase_35 AC 20 ms
23,328 KB
testcase_36 AC 19 ms
23,292 KB
testcase_37 AC 21 ms
23,580 KB
testcase_38 AC 22 ms
23,736 KB
testcase_39 AC 20 ms
23,604 KB
testcase_40 AC 20 ms
23,736 KB
testcase_41 AC 22 ms
23,304 KB
testcase_42 AC 20 ms
23,592 KB
testcase_43 AC 21 ms
23,676 KB
testcase_44 AC 19 ms
24,060 KB
testcase_45 AC 21 ms
23,472 KB
testcase_46 AC 22 ms
23,868 KB
testcase_47 AC 20 ms
23,916 KB
testcase_48 AC 20 ms
24,264 KB
testcase_49 AC 22 ms
23,580 KB
testcase_50 AC 21 ms
23,868 KB
testcase_51 AC 20 ms
23,880 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) (v).begin(),(v).end()

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

void print(int pr[4]) {
	REP(i, 4) printf("%d%c", pr[i], i == 3 ? '\n' : ' ');
	fflush(stdout);
}

pii get() {
	pii res;
	scanf("%d %d", &res.first, &res.second);
	return res;
}

int main() {
	srand((unsigned int)time(NULL));
	
	int ans[4], ng[4];
	
	vector<int> ord;
	REP(i, 10) ord.push_back(i);
	
	while (true) {
		REP(i, 100) swap(ord[rand() % 10], ord[rand() % 10]);
		
		REP(i, 4) ng[i] = ord[i];
		print(ng);
		
		pii now = get();
		if (now.first == 0 && now.second == 0) break;
	}
	
	REP(i, 4) ord.erase( find(ALL(ord), ng[i]) );
	
	REP(i, 4) {
		int tmp = ng[i];
		REP(j, ord.size()) {
			ng[i] = ord[j];
			
			print(ng);
			pii now = get();
			
			if (now.first == 1 && now.second == 0) break;
		}
		ans[i] = ng[i];
		ng[i] = tmp;
	}
	
	print(ans);
	
	return 0;
}
0