結果

問題 No.282 おもりと天秤(2)
ユーザー ShibuyapShibuyap
提出日時 2020-07-04 17:26:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,717 bytes
コンパイル時間 2,111 ms
コンパイル使用メモリ 206,504 KB
実行使用メモリ 24,408 KB
平均クエリ数 1001.00
最終ジャッジ日時 2023-09-24 03:46:27
合計ジャッジ時間 38,464 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 296 ms
24,012 KB
testcase_02 AC 203 ms
24,024 KB
testcase_03 AC 169 ms
23,484 KB
testcase_04 AC 150 ms
24,036 KB
testcase_05 AC 268 ms
23,592 KB
testcase_06 AC 318 ms
23,364 KB
testcase_07 AC 137 ms
23,592 KB
testcase_08 AC 326 ms
23,436 KB
testcase_09 AC 62 ms
24,024 KB
testcase_10 AC 1,609 ms
24,060 KB
testcase_11 AC 2,934 ms
24,024 KB
testcase_12 AC 1,707 ms
23,640 KB
testcase_13 AC 2,048 ms
23,544 KB
testcase_14 AC 2,698 ms
23,952 KB
testcase_15 AC 3,097 ms
24,156 KB
testcase_16 AC 769 ms
23,904 KB
testcase_17 AC 1,986 ms
24,408 KB
testcase_18 AC 2,544 ms
23,664 KB
testcase_19 AC 2,692 ms
23,640 KB
testcase_20 AC 3,363 ms
24,168 KB
testcase_21 AC 3,233 ms
23,532 KB
testcase_22 AC 3,124 ms
24,324 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n;
    cin >> n;
    int nn = n;
    int odd = 0;
    if(n % 2 == 1){
        odd = 1;
        n++;
    }
    int f[n+1][n+1];
    rep(i,n+1){
        rep(j,n+1){
            f[i][j] = 0;
        }
    }
    int a[1000] = {}, b[1000] = {};
    rep(i,n/2){
        a[i] = i+1;
        b[i] = n-i;
    }
    rep(_,1000){
        int x[2000] = {};
        rep(i,n/2){
            x[i*2] = a[i];
            x[i*2+1] = b[i];
            if(x[i*2] == n && odd == 1) x[i*2] = 0;
            if(x[i*2+1] == n && odd == 1) x[i*2+1] = 0;
        }
        cout << '?';
        rep(i,nn*2)cout << ' ' << x[i];
        cout << endl;
        fflush(stdout);
        rep(i,nn){
            char c;
            cin >> c;
            if(c == '<'){
                f[x[i*2]][x[i*2+1]] = 1;
            }
            if(c == '>'){
                f[x[i*2+1]][x[i*2]] = 1;
            }
        }
        int keep = a[n/2-1];
        drep(i,n/2){
            if(i == 0)break;
            a[i] = a[i-1];
        }
        a[1] = b[0];
        rep(i,n/2){
            b[i] = b[i+1];
        }
        b[n/2-1] = keep;
    }

    vector<P> v;
    srep(i,1,nn+1){
        int cnt = 0;
        srep(j,1,nn+1)cnt += f[i][j];
        v.push_back(P(-cnt,i));
    }

    sort(v.begin(), v.end());

    cout << '!';
    rep(i,v.size()){
        cout << ' ' << v[i].second;
    }
    cout << endl;

    return 0;
}
 
 
0