結果

問題 No.2085 Directed Complete Graph
ユーザー 259_Momone259_Momone
提出日時 2022-09-27 01:01:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 965 bytes
コンパイル時間 2,626 ms
コンパイル使用メモリ 263,328 KB
実行使用メモリ 24,480 KB
平均クエリ数 4917.82
最終ジャッジ日時 2023-08-24 03:22:49
合計ジャッジ時間 6,013 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
23,688 KB
testcase_01 AC 24 ms
23,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 100 ms
24,384 KB
testcase_06 AC 105 ms
24,264 KB
testcase_07 WA -
testcase_08 AC 138 ms
23,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 26 ms
24,060 KB
testcase_16 AC 24 ms
24,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/extc++.h>

int main() {
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<unsigned long> A(N);
    iota(begin(A), end(A), 1);
    mt19937_64 mt{random_device{}()};
    const auto cmp{[](unsigned long x){
        return [x](unsigned long y) -> bool {
            if(x == y)return 0;
            cout << "? " << y << " " << x << endl;
            unsigned long t;
            cin >> t;
            return t;
        };
    }};
    [rec_impl{[&A, &mt, &cmp](auto&& f, unsigned long l, unsigned long r) -> void {
        while(l + 1 < r){
            unsigned long d{uniform_int_distribution<unsigned long>{l, r - 1}(mt)};
            const auto m{partition(begin(A) + l, begin(A) + r, cmp(A[d])) - begin(A)};
            f(f, l, m);
            l = m;
        }
    }}, &N]{rec_impl(rec_impl, 0, N);}();
    cout << "!" << endl;
    cout << N - 1 << endl;
    for(const auto a : A)cout << a << " ";
    cout << endl;
    return 0;
}
0