結果

問題 No.282 おもりと天秤(2)
ユーザー koyoprokoyopro
提出日時 2015-10-25 17:18:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,621 ms / 5,000 ms
コード長 867 bytes
コンパイル時間 1,900 ms
コンパイル使用メモリ 145,528 KB
実行使用メモリ 24,312 KB
平均クエリ数 212.21
最終ジャッジ日時 2023-09-23 21:55:34
合計ジャッジ時間 17,054 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,024 KB
testcase_01 AC 27 ms
23,640 KB
testcase_02 AC 25 ms
23,640 KB
testcase_03 AC 23 ms
23,532 KB
testcase_04 AC 25 ms
23,616 KB
testcase_05 AC 27 ms
23,400 KB
testcase_06 AC 27 ms
24,024 KB
testcase_07 AC 25 ms
24,300 KB
testcase_08 AC 27 ms
24,312 KB
testcase_09 AC 22 ms
23,544 KB
testcase_10 AC 412 ms
23,628 KB
testcase_11 AC 1,393 ms
23,628 KB
testcase_12 AC 438 ms
23,808 KB
testcase_13 AC 697 ms
23,364 KB
testcase_14 AC 1,237 ms
23,364 KB
testcase_15 AC 1,448 ms
23,364 KB
testcase_16 AC 85 ms
23,664 KB
testcase_17 AC 655 ms
24,240 KB
testcase_18 AC 1,043 ms
23,640 KB
testcase_19 AC 1,078 ms
24,036 KB
testcase_20 AC 1,601 ms
23,988 KB
testcase_21 AC 1,579 ms
23,808 KB
testcase_22 AC 1,621 ms
23,808 KB
testcase_23 AC 23 ms
24,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

#define REP(i, n) for(int i=0; i<(n); i++)

int N,T;
signed main()
{
    cin >> N;
    vector<int> V(N+2, 0);
    REP(i,N) V[i] = (i+1);
    int ok = 0;
    REP(l,600) {
        int d = l % 2;
        cout << "?";
        REP(i,N) {
            if (2*i+1+d < N) {
                int a = V[2*i+d];
                int b = V[2*i+1+d];
                printf(" %d %d", a, b);
            } else {
                printf(" 0 0");
            }
        }
        cout << endl << flush;
        char op;
        ok++;
        REP(i,N) {
            cin >> op;
            if (op == '>') {
                swap(V[2*i+d], V[2*i+1+d]);
                ok = 0;
            }
        }
        if (ok >= 2) break;
    }
    cout << "!";
    REP(i,N) {
        cout << " " << V[i];
    }
    cout << endl << flush;
    return 0;
}
0