結果

問題 No.282 おもりと天秤(2)
ユーザー parukiparuki
提出日時 2016-07-10 00:43:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,504 bytes
コンパイル時間 1,824 ms
コンパイル使用メモリ 170,156 KB
実行使用メモリ 24,384 KB
平均クエリ数 917.12
最終ジャッジ日時 2023-09-23 11:01:50
合計ジャッジ時間 18,922 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
24,024 KB
testcase_01 AC 695 ms
23,412 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 573 ms
23,352 KB
testcase_06 AC 733 ms
24,348 KB
testcase_07 WA -
testcase_08 AC 712 ms
23,532 KB
testcase_09 AC 138 ms
23,508 KB
testcase_10 AC 3,586 ms
23,628 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

string nstr(){
    static const int MAX_LEN = 100001;
    static char res_[MAX_LEN];
    scanf("%s",res_);
    return string(res_);
}

int N;

vector<string> q1(vi &lr){
    printf("?");
    rep(i, N*2)
        printf(" %d", lr[i]);
    printf("\n");
    fflush(stdout);
    vector<string> res(N);
    rep(i, N)res[i] = nstr();
    return res;
}

void q2(vi &ans){
    printf("!");
    rep(i, sz(ans))printf(" %d", ans[i]);
    printf("\n");
    fflush(stdout);
}

int main(){
    scanf("%d", &N);
    vi ans(N);
    iota(all(ans), 1);
    int ok = 1;
    rep(iter, 1000){
        ok = 1;
        rep(s, 2){
            vi Q(N * 2);
            FOR(i, s, N)Q[i - s] = ans[i];
            auto C = q1(Q);
            for(int i = s, j = 0; ; i += 2, ++j){
                if(Q[i + 1] == 0)break;
                char c = C[j][0];
                if(c == '>'){
                    ok = 0;
                    swap(ans[i], ans[i + 1]);
                }
            }
        }
    }
    q2(ans);
}
0