結果

問題 No.355 数当てゲーム(2)
ユーザー femto
提出日時 2016-08-20 19:33:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 1,252 bytes
コンパイル時間 980 ms
コンパイル使用メモリ 86,104 KB
実行使用メモリ 25,580 KB
平均クエリ数 41.65
最終ジャッジ日時 2024-07-16 10:52:46
合計ジャッジ時間 4,710 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 51 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <deque>
#include <cassert>
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	vector<int> a;
	for(int i = 0; i < 10; i++) {
		deque<int> v;
		for(int j = 0; j < 10; j++) {
			if(i != j) v.push_back(j);
		}

		int sum = 0;
		for(int j = 0; j < 3; j++) {
			cout << i << " ";
			for(int k = 0; k < 3; k++) {
				cout << v.front() << " ";
				v.pop_front();
			}
			cout << endl;
			cout.flush();
			int x, y;
			cin >> x >> y;
			sum += x + y;
		}

		if(sum == 6) {
			a.push_back(i);
		}
	}
	assert(a.size() == 4);

	bool used[4] = { 0 };
	for(int i = 0; i < 4; i++) {
		for(int j = 0; j < 4; j++) {
			for(int k = 0; k < 4; k++) {
				for(int l = 0; l < 4; l++) {
					int ans[4] = { a[i], a[j], a[k], a[l] };
					bool flag = true;
					for(int m = 0; m < 4; m++) {
						for(int n = m+1; n < 4; n++) {
							if(ans[n] == ans[m]) flag = false;
						}
					}
					if(flag) {
						for(int m = 0; m < 4; m++) {
							cout << ans[m] << " ";
						}
						cout << endl;
						cout.flush();
						int x, y;
						cin >> x >> y;
						if(x == 4) return 0;
					}
				}
			}
		}
	}
}
0