結果

問題 No.355 数当てゲーム(2)
ユーザー odan3240odan3240
提出日時 2016-04-03 23:38:04
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,314 bytes
コンパイル時間 731 ms
コンパイル使用メモリ 82,740 KB
実行使用メモリ 24,444 KB
平均クエリ数 37.10
最終ジャッジ日時 2023-09-23 10:13:51
合計ジャッジ時間 5,517 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,964 KB
testcase_01 AC 26 ms
24,276 KB
testcase_02 AC 25 ms
23,832 KB
testcase_03 AC 26 ms
23,676 KB
testcase_04 AC 25 ms
24,300 KB
testcase_05 AC 25 ms
23,460 KB
testcase_06 AC 26 ms
23,424 KB
testcase_07 AC 25 ms
24,276 KB
testcase_08 AC 25 ms
23,376 KB
testcase_09 AC 26 ms
23,604 KB
testcase_10 AC 25 ms
23,484 KB
testcase_11 AC 25 ms
23,988 KB
testcase_12 AC 25 ms
23,976 KB
testcase_13 AC 27 ms
24,324 KB
testcase_14 AC 25 ms
23,412 KB
testcase_15 AC 26 ms
23,628 KB
testcase_16 AC 25 ms
23,772 KB
testcase_17 AC 25 ms
23,772 KB
testcase_18 AC 25 ms
23,832 KB
testcase_19 AC 26 ms
23,412 KB
testcase_20 AC 26 ms
23,472 KB
testcase_21 AC 26 ms
23,964 KB
testcase_22 AC 25 ms
24,300 KB
testcase_23 AC 25 ms
23,964 KB
testcase_24 AC 26 ms
23,964 KB
testcase_25 AC 25 ms
23,568 KB
testcase_26 AC 25 ms
23,352 KB
testcase_27 AC 25 ms
23,664 KB
testcase_28 AC 26 ms
24,372 KB
testcase_29 AC 26 ms
23,568 KB
testcase_30 AC 28 ms
24,336 KB
testcase_31 AC 26 ms
24,276 KB
testcase_32 AC 25 ms
23,976 KB
testcase_33 AC 25 ms
23,328 KB
testcase_34 AC 26 ms
24,276 KB
testcase_35 WA -
testcase_36 AC 25 ms
23,412 KB
testcase_37 AC 25 ms
23,988 KB
testcase_38 AC 25 ms
23,352 KB
testcase_39 AC 26 ms
23,520 KB
testcase_40 AC 26 ms
23,964 KB
testcase_41 AC 28 ms
24,360 KB
testcase_42 AC 24 ms
24,036 KB
testcase_43 AC 24 ms
23,976 KB
testcase_44 AC 25 ms
24,324 KB
testcase_45 WA -
testcase_46 AC 27 ms
23,376 KB
testcase_47 AC 25 ms
23,988 KB
testcase_48 AC 25 ms
23,580 KB
testcase_49 AC 26 ms
23,460 KB
testcase_50 AC 26 ms
24,276 KB
testcase_51 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF=1e9;
const ll MOD=1e9+7;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

vector<int> ans;
pair<int,int> query(vector<int> vec) {
    rep(i,4) cout<<vec[i]<<(i==3?"\n":" ");
    cout<<flush;
    pair<int,int> ret;
    cin>>ret.first>>ret.second;
    return ret;
}
int sum(pair<int,int> p) {
    return p.first+p.second;
}
int main() {
    ans.resize(4);
    rep(i,4) ans[i]=i;
    vector<int> vec=ans;
    vec.resize(4);
    rep(i,4) {
        auto p=query(ans);
        rep(j,10) if(find(all(vec), j)==vec.end()) {
            vec[i]=j;
            auto t=query(vec);
            if(sum(t)>sum(p)) {
                p=t;
                ans=vec;
                break;
            }
        }
        vec=ans;
    }
    sort(all(ans));
    do {
        auto p=query(ans);
        if(p.first==4) break;
    }while(std::next_permutation(all(ans)));

    return 0;
}
0