結果
問題 | No.2085 Directed Complete Graph |
ユーザー |
![]() |
提出日時 | 2022-09-27 01:01:49 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 965 bytes |
コンパイル時間 | 4,359 ms |
コンパイル使用メモリ | 253,476 KB |
最終ジャッジ日時 | 2025-02-07 16:36:47 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 10 |
ソースコード
#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;}