結果
問題 | No.2085 Directed Complete Graph |
ユーザー |
![]() |
提出日時 | 2022-09-27 01:05:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 969 bytes |
コンパイル時間 | 3,638 ms |
コンパイル使用メモリ | 254,692 KB |
最終ジャッジ日時 | 2025-02-07 16:37:24 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 1 WA * 14 |
ソースコード
#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 + 1;}}}, &N]{rec_impl(rec_impl, 0, N);}();cout << "!" << endl;cout << N - 1 << endl;for(const auto a : A)cout << a << " ";cout << endl;return 0;}