結果
| 問題 | No.3591 I Love Graph |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-17 22:03:04 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 975 bytes |
| 記録 | |
| コンパイル時間 | 2,138 ms |
| コンパイル使用メモリ | 340,168 KB |
| 実行使用メモリ | 5,888 KB |
| 平均クエリ数 | 3342.83 |
| 最終ジャッジ日時 | 2026-07-17 22:03:12 |
| 合計ジャッジ時間 | 7,517 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 RE * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void){
int n;
cin>>n;
stack<array<int,3>>st;
vector<array<int,2>>ans;
for(int i=n-2;i>=0;i--){
st.push({i,i+1,n-1});
}
int q=0;
while(!st.empty()){
array<int,3>tmp=st.top();
st.pop();
if(q>4500)return 1;
q++;
cout<<"? 1 "<<tmp[2]-tmp[1]+1<<" "<<tmp[0]+1<<" ";
for(int i=tmp[1];i<=tmp[2];i++){
cout<<i+1<<(i!=tmp[2]?" ":"");
}
cout<<endl;
int a;
cin>>a;
if(a==-1)return 1;
if(a){
if(tmp[2]==tmp[1]){
ans.push_back({tmp[0],tmp[1]});
}else{
st.push({tmp[0],tmp[1],(tmp[1]+tmp[2])/2});
st.push({tmp[0],(tmp[1]+tmp[2])/2+1,tmp[2]});
}
}
}
cout<<"! "<<ans.size()<<endl;
for(int i=0;i<ans.size();i++){
cout<<ans[i][0]+1<<" "<<ans[i][1]+1<<endl;
}
return 0;
}