結果
| 問題 | No.2085 Directed Complete Graph |
| ユーザー |
|
| 提出日時 | 2026-04-25 01:06:03 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 885 bytes |
| 記録 | |
| コンパイル時間 | 2,171 ms |
| コンパイル使用メモリ | 335,440 KB |
| 実行使用メモリ | 6,528 KB |
| 平均クエリ数 | 2471.00 |
| 最終ジャッジ日時 | 2026-09-12 04:31:04 |
| 合計ジャッジ時間 | 5,752 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
vector<int> merge_sort(int l, int r) {
if (r - l <= 1) return {l};
int m = (l + r) / 2;
auto L = merge_sort(l, m);
auto R = merge_sort(m, r);
vector<int> res;
int i = 0, j = 0;
while (i < (int)L.size() && j < (int)R.size()) {
cout << "? " << L[i] << " " << R[j] << endl;
int t; cin >> t;
if (t) { res.push_back(L[i]); i++; }
else { res.push_back(R[j]); j++; }
}
while (i < (int)L.size()) { res.push_back(L[i]); i++; }
while (j < (int)R.size()) { res.push_back(R[j]); j++; }
return res;
}
int main() {
int n; cin >> n;
auto path = merge_sort(1, n + 1);
cout << "! " << n << endl;
for (int i = 0; i < n; i++) {
if (i) cout << " ";
cout << path[i];
}
cout << endl;
}