結果

問題 No.355 数当てゲーム(2)
ユーザー はまやんはまやんはまやんはまやん
提出日時 2016-04-02 00:12:13
言語 C++11
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 2,155 bytes
コンパイル時間 1,643 ms
コンパイル使用メモリ 177,072 KB
実行使用メモリ 25,616 KB
平均クエリ数 26.54
最終ジャッジ日時 2024-07-16 09:31:12
合計ジャッジ時間 18,890 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 1 RE * 45
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘vs make_str(vi, int)’:
main.cpp:47:1: warning: control reaches end of non-void function [-Wreturn-type]
   47 | }
      | ^

ソースコード

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)
{
	if (a[0] == 0)
	{
		if (num == 0)
			return vs{ "" };
		else if (num == 1)
			return vs{ " 0", " 1", " 2", " 3" };
		else if (num == 2)
			return vs{ " 0 1", " 0 2", " 0 3", " 1 2", " 1 3", " 2 3" };
		else if (num == 3)
			return vs{ " 0 1 2", " 0 1 3", " 0 2 3", " 1 2 3" };
		else if (num == 4)
			return vs{ " 0 1 2 3" };
	}
	else if (a[0] == 4)
	{
		if (num == 0)
			return vs{ "" };
		else if (num == 1)
			return vs{ " 4", " 5", " 6", " 7" };
		else if (num == 2)
			return vs{ " 4 5", " 4 6", " 4 7", " 5 6", " 5 7", "6 7" };
		else if (num == 3)
			return vs{ " 4 5 6", " 4 5 7", " 4 6 7", " 5 6 7" };
		else if (num == 4)
			return vs{ " 4 5 6 7" };
	}
	else
	{
		if (num == 0)
			return vs{ "" };
		else if (num == 1)
			return vs{ " 8", " 9" };
		else if (num == 2)
			return vs{ " 8 9" };
	}
}

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;


	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 (s.find(to_string(i)) != string::npos) use.insert(i);
			rep(i, 4, 8) if (s.find(to_string(i)) != string::npos) use.insert(i);
			rep(i, 8, 10) if (s.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