結果

問題 No.282 おもりと天秤(2)
ユーザー parukiparuki
提出日時 2018-03-11 19:27:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4,216 ms / 5,000 ms
コード長 1,299 bytes
コンパイル時間 1,499 ms
コンパイル使用メモリ 167,684 KB
実行使用メモリ 24,312 KB
平均クエリ数 1201.00
最終ジャッジ日時 2023-09-24 01:42:46
合計ジャッジ時間 48,191 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
23,508 KB
testcase_01 AC 414 ms
24,264 KB
testcase_02 AC 268 ms
24,036 KB
testcase_03 AC 222 ms
23,640 KB
testcase_04 AC 187 ms
23,832 KB
testcase_05 AC 357 ms
24,312 KB
testcase_06 AC 421 ms
23,640 KB
testcase_07 AC 201 ms
23,988 KB
testcase_08 AC 437 ms
24,012 KB
testcase_09 AC 87 ms
23,388 KB
testcase_10 AC 2,156 ms
23,520 KB
testcase_11 AC 4,061 ms
23,640 KB
testcase_12 AC 2,233 ms
23,784 KB
testcase_13 AC 2,635 ms
24,204 KB
testcase_14 AC 3,511 ms
23,520 KB
testcase_15 AC 4,216 ms
24,048 KB
testcase_16 AC 1,012 ms
24,240 KB
testcase_17 AC 2,586 ms
23,388 KB
testcase_18 AC 3,276 ms
24,120 KB
testcase_19 AC 3,462 ms
23,892 KB
testcase_20 AC 4,008 ms
24,024 KB
testcase_21 AC 4,181 ms
23,412 KB
testcase_22 AC 4,190 ms
24,036 KB
testcase_23 AC 64 ms
23,832 KB
権限があれば一括ダウンロードができます

ソースコード

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;

int N;

string q1(vi &lr){
    printf("?");
    rep(i, N*2)
        printf(" %d", lr[i]);
    printf("\n");
    fflush(stdout);
    string res;
    rep(i, N) {
        char c;
        cin >> c;
        res += c;
    }
    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);
    rep(iter, 600){
        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 + 1 < N; i += 2, ++j){
                char c = C[j];
                if(c == '>'){
                    swap(ans[i], ans[i + 1]);
                }
            }
        }
    }
    q2(ans);
}
0