結果

問題 No.355 数当てゲーム(2)
ユーザー tempura-samatempura-sama
提出日時 2016-05-17 15:12:29
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 984 bytes
コンパイル時間 869 ms
コンパイル使用メモリ 56,420 KB
実行使用メモリ 24,384 KB
平均クエリ数 21.37
最終ジャッジ日時 2023-09-23 10:38:11
合計ジャッジ時間 5,436 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,592 KB
testcase_01 AC 27 ms
23,592 KB
testcase_02 AC 26 ms
23,988 KB
testcase_03 AC 25 ms
23,628 KB
testcase_04 AC 26 ms
24,000 KB
testcase_05 WA -
testcase_06 AC 25 ms
23,604 KB
testcase_07 AC 24 ms
23,796 KB
testcase_08 AC 25 ms
23,412 KB
testcase_09 AC 26 ms
23,376 KB
testcase_10 WA -
testcase_11 AC 25 ms
24,012 KB
testcase_12 AC 25 ms
23,784 KB
testcase_13 AC 26 ms
24,012 KB
testcase_14 AC 25 ms
24,288 KB
testcase_15 AC 26 ms
24,000 KB
testcase_16 AC 25 ms
23,988 KB
testcase_17 AC 26 ms
24,288 KB
testcase_18 AC 25 ms
23,640 KB
testcase_19 AC 25 ms
23,412 KB
testcase_20 AC 26 ms
23,508 KB
testcase_21 AC 25 ms
24,012 KB
testcase_22 AC 24 ms
24,012 KB
testcase_23 AC 25 ms
24,048 KB
testcase_24 AC 25 ms
23,496 KB
testcase_25 AC 25 ms
23,832 KB
testcase_26 AC 25 ms
23,832 KB
testcase_27 AC 26 ms
23,988 KB
testcase_28 AC 25 ms
23,832 KB
testcase_29 AC 25 ms
23,412 KB
testcase_30 AC 25 ms
24,000 KB
testcase_31 AC 25 ms
24,060 KB
testcase_32 AC 25 ms
23,340 KB
testcase_33 AC 25 ms
23,496 KB
testcase_34 AC 25 ms
23,664 KB
testcase_35 WA -
testcase_36 AC 25 ms
24,252 KB
testcase_37 AC 25 ms
24,252 KB
testcase_38 AC 25 ms
23,796 KB
testcase_39 AC 27 ms
23,376 KB
testcase_40 AC 25 ms
24,276 KB
testcase_41 AC 25 ms
23,424 KB
testcase_42 AC 25 ms
23,664 KB
testcase_43 AC 26 ms
23,796 KB
testcase_44 AC 27 ms
23,388 KB
testcase_45 WA -
testcase_46 AC 24 ms
23,376 KB
testcase_47 AC 25 ms
23,376 KB
testcase_48 AC 25 ms
23,520 KB
testcase_49 AC 25 ms
23,364 KB
testcase_50 AC 25 ms
24,384 KB
testcase_51 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <list>
using namespace std;

void io(int n[4], int& x, int& y)
{
	cout << n[0] << " " << n[1] << " " << n[2] << " " << n[3] << endl;
	cin >> x >> y;
}

int main()
{
	int n[] = { 0, 1, 2, 3 };
	int x, y;

	int xy;
	io(n, x, y);
	xy = x + y;

	list<int> l { 4, 5, 6, 7, 8, 9 };
	for ( int i = 0; i < 4; i++ ) {
		for ( auto l_it = l.begin(); xy < 4 && l_it != l.end(); ++l_it) {
			int t = n[i];
			n[i] = *l_it;
			io(n, x, y);
			if ( x + y > xy ) {
				l.erase(l_it);
				xy = x + y;
				break;
			}
			else if ( x + y < xy ) {
				n[i] = t;
				break;
			}
		}
	}

	for ( int i = 0; i < 4; i++ ) {
		for ( int j = 0; j < 4; j++ ) {
			if ( i == j ) continue;
			for ( int k = 0; k < 4; k++ ) {
				if ( i == k || j == k ) continue;
				for ( int l = 0; l < 4; l++ ) {
				if ( i == l || j == l || k == l ) continue;
					int r[] = { n[i], n[j], n[k], n[l] };
					io(r, x, y);
					if ( x == 4 ) {
						return 0;
					}
				}
			}
		}
	}

	return 0;
}
0