結果

問題 No.934 Explosive energy drink
ユーザー hiro71687khiro71687k
提出日時 2023-04-16 17:55:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 348 ms / 2,000 ms
コード長 1,324 bytes
コンパイル時間 4,332 ms
コンパイル使用メモリ 259,556 KB
実行使用メモリ 25,476 KB
平均クエリ数 709.42
最終ジャッジ日時 2024-04-20 06:09:52
合計ジャッジ時間 8,542 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,556 KB
testcase_01 AC 182 ms
24,964 KB
testcase_02 AC 23 ms
24,836 KB
testcase_03 AC 101 ms
24,580 KB
testcase_04 AC 348 ms
24,964 KB
testcase_05 AC 19 ms
25,220 KB
testcase_06 AC 24 ms
24,964 KB
testcase_07 AC 18 ms
24,836 KB
testcase_08 AC 23 ms
24,580 KB
testcase_09 AC 23 ms
24,836 KB
testcase_10 AC 25 ms
25,220 KB
testcase_11 AC 25 ms
25,220 KB
testcase_12 AC 22 ms
25,220 KB
testcase_13 AC 24 ms
24,836 KB
testcase_14 AC 26 ms
25,476 KB
testcase_15 AC 100 ms
24,964 KB
testcase_16 AC 32 ms
25,220 KB
testcase_17 AC 45 ms
25,220 KB
testcase_18 AC 48 ms
25,220 KB
testcase_19 AC 84 ms
25,220 KB
testcase_20 AC 131 ms
24,836 KB
testcase_21 AC 139 ms
24,808 KB
testcase_22 AC 198 ms
25,220 KB
testcase_23 AC 206 ms
25,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=1444999999;
ll mod=1000000007;
int main(){
    ll n;
    cin >> n;
    vector<ll>a,b;
    for (ll i = 0; i < n; i++)
    {
        a.push_back(i+1);
    }
    while (!a.empty())
    {
        ll x=a.size();
        x+=b.size();
        if (x==2)
        {
            for (ll i = 0; i < a.size(); i++)
            {
                b.push_back(a[i]);
            }
            break;
        }
        cout << "? " << x-1 << endl;
        vector<ll>c;
        for (ll i = 0; i < b.size(); i++)
        {
            c.push_back(b[i]);
        }
        ll aa=a.size();
        for (ll i = 0; i < aa-1; i++)
        {
            c.push_back(a[i]);
        }
        sort(c.begin(),c.end());
        for (ll i = 0; i < c.size(); i++)
        {
            cout << c[i] << ' ';
        }
        cout << endl;
        ll y;
        cin >> y;
        if (y==0)
        {
            b.push_back(a[a.size()-1]);
            a.pop_back();
        }else{
            a.pop_back();
        }
    }
    cout << "! " << b.size() << endl;
    sort(b.begin(),b.end());
    for (ll i = 0; i < b.size(); i++)
    {
        cout << b[i]<< ' ';
    }
    cout << endl;
}
0