結果

問題 No.3591 I Love Graph
コンテスト
ユーザー t98slider
提出日時 2026-07-17 22:51:31
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,352 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,087 ms
コンパイル使用メモリ 335,560 KB
実行使用メモリ 5,888 KB
平均クエリ数 4312.17
最終ジャッジ日時 2026-07-17 22:51:40
合計ジャッジ時間 8,157 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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;
}

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<pair<int,int>> ans;
    const int th = 20;
    for(int i = 0; i < n; i++){
        for(int l = i + 1; l < n; l += th){
            int r = min(n, l + th);
            cout << "? 1 " << r - l << " " << i + 1;
            for(int j = l; j < r; j++){
                cout << ' ' << j + 1;
            }
            cout << endl;
            int res;
            cin >> res;
            if(res == 1){
                for(int j = l; j < r; j++){
                    cout << "? 1 1 " << i + 1 << ' ' << j + 1 << endl;
                    cin >> res;
                    if(res == 1) ans.emplace_back(i + 1, j + 1);
                }
            }
        }
    }
    cout << "! " << ans.size() << endl;
    for(auto &&[u, v] : ans) cout << u << ' ' << v << '\n';
    cout << endl;
}
0