結果
| 問題 |
No.2085 Directed Complete Graph
|
| ユーザー |
|
| 提出日時 | 2024-10-31 02:53:32 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,195 bytes |
| コンパイル時間 | 5,580 ms |
| コンパイル使用メモリ | 309,936 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 1651.88 |
| 最終ジャッジ日時 | 2024-10-31 02:53:42 |
| 合計ジャッジ時間 | 9,267 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 WA * 3 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using mint = atcoder::static_modint<998244353>;
//using mint = atcoder::static_modint<1000000007>;
using namespace std;
using namespace atcoder;
using ld = long double;
using ll = long long;
#define mp(a,b) make_pair(a,b)
#define rep(i,s,n) for(int i=s; i<n; i++)
#define _GLIBCXX_DEBUG
const vector<int> dx{1,0,-1,0},dy{0,1,0,-1};
int main(){
int n;cin >> n;
cout << "? " << 1 << " " << 2 << "\n";
int t;cin >> t;
vector<int> a;
if(t==1)a={1,2};
else a={2,1};
rep(i,3,n+1){
cout << "? " << i << " " << a[0] << "\n";
cin >> t;
if(t==1){
a.insert(a.begin(),i);
continue;
}
cout << "? " << a.back() << " " << i << "\n";
cin >> t;
if(t==1){
a.push_back(i);
continue;
}
int l=0,r=a.size()-1;
while(r-l>1){
int mid=(r+l)/2;
cout << "? " << i << " " << a[mid] << "\n";
cin >> t;
if(t==1)r=mid;
else l=mid;
}
a.insert(a.begin()+r,i);
}
cout << "!\n";
cout << n-1 << "\n";
for(auto x:a)cout << x << " ";
}