結果

問題 No.355 数当てゲーム(2)
ユーザー finefine
提出日時 2017-01-06 22:52:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,447 bytes
コンパイル時間 3,095 ms
コンパイル使用メモリ 169,344 KB
実行使用メモリ 31,976 KB
平均クエリ数 1176.21
最終ジャッジ日時 2023-09-23 12:33:38
合計ジャッジ時間 13,128 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int a[2][4] = {{0, 1, 2, 3}, {4, 7, 8, 9}};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<int> data;
	bool flag = false;
	bool memo[4][10] = {};
	for (int i = 0; i < 2; i++) {
		for (int idx = 0; idx < 4; idx++) {
			cout << a[i][idx];
			if (idx == 3) cout << endl;
			else cout << " ";
		}
		int X, Y;
		cin >> X >> Y;
		if (Y == 4) {
			for (int idx = 0; idx < 4; idx++) {
				data.push_back(a[i][idx]);
			}
			flag = true;
			break;
		}
		for (int j = 0; j < 10; j++) {
			if (i == 0 && j <= 3) continue;
			if (i == 1 && j > 4) continue;
			a[i][0] = j;
			for (int idx = 0; idx < 4; idx++) {
				cout << a[i][idx];
				if (idx == 3) cout << endl;
				else cout << " ";
			}
			int x, y;
			cin >> x >> y;
			for (int s = 0; s < 4; s++) {
				if ((s >> i) & 1) {
					if (y == Y) memo[s][j] = true;
				} else {
					if (y > Y) memo[s][j] =true;
				}
			} 
		}
	}

	if (!flag) {
		for (int s = 0; s < 4; s++) {
			if (s & 1 != 0 && !memo[s][0]) continue;
			if (s & 2 != 0 && !memo[s][4]) continue;
			data.clear();
			for (int j = 0; j < 10; j++) {
				if (memo[s][j]) data.push_back(j);
			}
			if (data.size() == 4) break;
		}
	}

	do {
		for (int idx = 0; idx < 4; idx++) {
			cout << data[idx];
			if (idx == 3) cout << endl;
			else cout << " ";
		}
		int X, Y;
		cin >> X >> Y;
		if (X == 4) break;
	} while (next_permutation(data.begin(), data.end()));
	return 0;
}
0