結果

問題 No.355 数当てゲーム(2)
ユーザー mayoko_mayoko_
提出日時 2016-04-01 23:03:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 1,813 bytes
コンパイル時間 828 ms
コンパイル使用メモリ 84,620 KB
実行使用メモリ 24,240 KB
平均クエリ数 36.92
最終ジャッジ日時 2023-09-23 23:24:53
合計ジャッジ時間 4,875 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
23,232 KB
testcase_01 AC 26 ms
23,340 KB
testcase_02 AC 25 ms
23,496 KB
testcase_03 AC 25 ms
23,388 KB
testcase_04 AC 24 ms
23,496 KB
testcase_05 AC 24 ms
23,352 KB
testcase_06 AC 26 ms
23,352 KB
testcase_07 AC 25 ms
24,240 KB
testcase_08 AC 26 ms
23,352 KB
testcase_09 AC 25 ms
23,484 KB
testcase_10 AC 26 ms
23,220 KB
testcase_11 AC 26 ms
23,808 KB
testcase_12 AC 26 ms
24,156 KB
testcase_13 AC 25 ms
24,012 KB
testcase_14 AC 25 ms
23,616 KB
testcase_15 AC 26 ms
23,616 KB
testcase_16 AC 24 ms
23,868 KB
testcase_17 AC 25 ms
23,520 KB
testcase_18 AC 26 ms
23,196 KB
testcase_19 AC 24 ms
24,228 KB
testcase_20 AC 24 ms
24,024 KB
testcase_21 AC 26 ms
23,496 KB
testcase_22 AC 26 ms
23,220 KB
testcase_23 AC 26 ms
23,628 KB
testcase_24 AC 26 ms
23,364 KB
testcase_25 AC 26 ms
23,856 KB
testcase_26 AC 24 ms
23,616 KB
testcase_27 AC 24 ms
23,676 KB
testcase_28 AC 25 ms
24,084 KB
testcase_29 AC 25 ms
24,048 KB
testcase_30 AC 26 ms
23,364 KB
testcase_31 AC 25 ms
23,796 KB
testcase_32 AC 26 ms
23,628 KB
testcase_33 AC 27 ms
24,084 KB
testcase_34 AC 28 ms
23,388 KB
testcase_35 AC 25 ms
23,820 KB
testcase_36 AC 26 ms
23,640 KB
testcase_37 AC 26 ms
23,388 KB
testcase_38 AC 25 ms
23,856 KB
testcase_39 AC 24 ms
23,472 KB
testcase_40 AC 25 ms
24,108 KB
testcase_41 AC 27 ms
23,232 KB
testcase_42 AC 26 ms
23,232 KB
testcase_43 AC 26 ms
23,376 KB
testcase_44 AC 24 ms
23,808 KB
testcase_45 AC 25 ms
23,796 KB
testcase_46 AC 25 ms
23,796 KB
testcase_47 AC 25 ms
23,508 KB
testcase_48 AC 26 ms
24,084 KB
testcase_49 AC 25 ms
23,808 KB
testcase_50 AC 26 ms
23,628 KB
testcase_51 AC 26 ms
23,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
#include<complex>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

int ans[] = {-1, -1, -1, -1};

void readXY(int& x, int& y) {
    cin >> x >> y;
    if (x==4 && y==0) exit(0);
}

bool NG(const vi& ok, int num) {
    for (int el : ok) if (num==el) return true;
    return false;
}

int main() {
    vector<int> ok;
    for (int t = 0; t < 4; t++) {
        int atLeast = 3-ok.size();
        vector<int> tmp(10);
        int maxi = 0;
        for (int num = atLeast; num < 10; num++) {
            if (NG(ok, num)) continue;
            // 確定してるやつ
            for (int el : ok) {
                cout << el << " ";
            }
            for (int i = 0; i < atLeast; i++) cout << i << " ";
            cout << num << endl;
            int x, y;
            readXY(x, y);
            tmp[num] = x+y; maxi = max(maxi, x+y);
        }
        for (int num = 9; num >= atLeast; num--) {
            if (tmp[num] == maxi) {
                ok.push_back(num);
                break;
            }
        }
    }
    sort(ok.begin(), ok.end());
    do {
        for (int i = 0; i < 4; i++) {
            cout << ok[i];
            if (i < 3) cout << " ";
        }
        cout << endl;
        int x, y;
        readXY(x, y);
    } while (next_permutation(ok.begin(), ok.end()));
    return 0;
}
0