結果

問題 No.355 数当てゲーム(2)
ユーザー
提出日時 2020-11-30 18:14:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 1,004 bytes
コンパイル時間 871 ms
コンパイル使用メモリ 98,356 KB
実行使用メモリ 25,464 KB
平均クエリ数 41.17
最終ジャッジ日時 2024-07-17 02:55:55
合計ジャッジ時間 5,009 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 52
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
vector<int> ans;
int main() {
	int x, y;
	int num[10];
	for (int i = 0; i < 9; i++) {
		num[i] = i + 1;
	}
	for (int i = 0; i <= 9; i++) {
		int co = 0;
		for (int j = 0; j < 9; j += 3) {
			cout << num[j] << " " << num[j + 1] << " " << num[j + 2] << " " << i << endl;
			cin >> x >> y;
			if (x == 4) {
				return 0;
			}
			co += x;
			co += y;
		}
		if (co == 6) {
			ans.emplace_back(i);
		}
		num[i]--;
	}
	cout << ans[0] << " " << ans[1] << " " << ans[2] << " " << ans[3] << endl;
	cin >> x >> y;
	if (x == 4) {
		return 0;
	}
	while (next_permutation(ans.begin(), ans.end())) {
		cout << ans[0] << " " << ans[1] << " " << ans[2] << " " << ans[3] << endl;
		cin >> x >> y;
		if (x == 4) {
			return 0;
		}
	}
}
0