結果
| 問題 | No.3591 I Love Graph |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-17 23:04:12 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,081 bytes |
| 記録 | |
| コンパイル時間 | 2,230 ms |
| コンパイル使用メモリ | 341,208 KB |
| 実行使用メモリ | 5,888 KB |
| 平均クエリ数 | 5706.72 |
| 最終ジャッジ日時 | 2026-07-17 23:04:22 |
| 合計ジャッジ時間 | 9,207 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 33 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> istream& operator >> (istream& is, vector<T>& vec) {
for(T& x : vec) is >> x;
return is;
}
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) {
if(vec.empty()) return os;
os << vec[0];
for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it;
return os;
}
unsigned long long xor64() {
static unsigned long long x
= (unsigned long long)(chrono::duration_cast<chrono::nanoseconds>(
chrono::high_resolution_clock::now().time_since_epoch()).count())
* 10150724397891781847ULL;
x ^= x << 7;
return x ^= x >> 9;
}
array<array<int,400>,400> T;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
for(int i = 0; i < n; i++) T[i].fill(1);
vector<int> ord(n);
iota(ord.begin(), ord.end(), 0);
constexpr int BL = 20;
int Q = 4500;
while(Q >= 1){
for(int i = 1; i < n; i++) swap(ord[i], ord[xor64() % n]);
for(int i = 0; i < n && Q >= 1; i += BL){
Q--;
int l = i, r = min(n, i + BL);
if(r - l <= 1) break;
int mid = (l + r) / 2;
vector<int> a, b;
for(int j = l; j < r; j++){
if(j < mid) a.emplace_back(ord[j] + 1);
else b.emplace_back(ord[j] + 1);
}
int res;
cout << "? " << a.size() << " " << b.size() << " " << a << " " << b << endl;
cin >> res;
if(res == 0){
for(auto u : a){
for(auto v : b){
T[u - 1][v - 1] = T[v - 1][u - 1] = 0;
}
}
}
}
}
vector<pair<int,int>> ans;
for(int i = 0; i < n; i++){
for(int j = i + 1; j < n; j++){
if(T[i][j] == 1) ans.emplace_back(i + 1, j + 1);
}
}
cout << "! " << ans.size() << endl;
for(auto [u, v] : ans) cout << u << " " << v << '\n';
cout << endl;
}