結果

問題 No.355 数当てゲーム(2)
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2016-04-02 00:00:38
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,754 bytes
コンパイル時間 2,334 ms
コンパイル使用メモリ 173,992 KB
実行使用メモリ 24,444 KB
平均クエリ数 58.29
最終ジャッジ日時 2023-09-23 09:58:54
合計ジャッジ時間 18,008 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
23,904 KB
testcase_01 AC 29 ms
24,432 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 WA -
testcase_07 AC 28 ms
24,420 KB
testcase_08 AC 28 ms
23,700 KB
testcase_09 AC 29 ms
24,096 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 29 ms
23,472 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 WA -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 WA -
testcase_31 RE -
testcase_32 AC 30 ms
24,000 KB
testcase_33 WA -
testcase_34 RE -
testcase_35 AC 27 ms
23,484 KB
testcase_36 AC 27 ms
24,084 KB
testcase_37 RE -
testcase_38 RE -
testcase_39 AC 29 ms
23,448 KB
testcase_40 RE -
testcase_41 WA -
testcase_42 AC 31 ms
23,352 KB
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 WA -
testcase_47 AC 29 ms
23,472 KB
testcase_48 RE -
testcase_49 AC 31 ms
23,580 KB
testcase_50 WA -
testcase_51 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

typedef pair<int, int> pii;

vs make_str(vi a, int num)
{
	queue<string> que;
	que.push("");
	rep(i, 0, num)
	{
		queue<string> q;
		while (!que.empty())
		{
			string s = que.front(); que.pop();
			for (int aa : a)
			{
				if(s.find(to_string(aa)) == string::npos) q.push(s + " " + to_string(aa));
			}
		}
		que = q;
	}
	vs ret;
	while (!que.empty())
	{
		string s = que.front(); que.pop();
		ret.push_back(s);
	}
	return ret;
}

int main()
{
	cout << "0 1 2 3" << endl;
	int x, y;
	cin >> x >> y;
	if (x == 4) return 0;

	cout << "4 5 6 7" << endl;
	int xx, yy;
	cin >> xx >> yy;
	if (xx == 4) return 0;

	//int y = 1;
	//int yy = 2;


	set<int> use;
	vs a = make_str(vi{ 0, 1, 2, 3 }, y);
	vs b = make_str(vi{ 4, 5, 6, 7 }, yy);
	vs c = make_str(vi{ 8, 9 }, 4 - y - yy);
	
	for (string sa : a) for (string sb : b) for(string sc : c)
	{
		string s = sa + sb + sc;
		s = s.substr(1);
		cout << s << endl;
		int x, y;
		//x = y = 0;
		cin >> x >> y;
		if (x == 4) return 0;
		if (y == 4)
		{
			rep(i, 0, 4) if (sa.find(to_string(i)) != string::npos) use.insert(i);
			rep(i, 4, 8) if (sb.find(to_string(i)) != string::npos) use.insert(i);
			rep(i, 8, 10) if (sc.find(to_string(i)) != string::npos) use.insert(i);
		}
	}

	vi nums;
	for (int i : use) nums.push_back(i);
	rep(i, 0, 4) rep(j, 0, 4) rep(k, 0, 4) rep(l, 0, 4)
	{
		if (i == j) continue;
		if (i == k) continue;
		if (i == l) continue;
		if (j == k) continue;
		if (j == l) continue;
		if (k == l) continue;

		printf("%d %d %d %d\n", nums[i], nums[j], nums[k], nums[l]);
		int x, y;
		cin >> x >> y;
		if (x == 4) return 0;
	}
}
0