QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#338910 | #4218. Hidden Graph | YMH_fourteen | WA | 1ms | 3776kb | C++14 | 1.1kb | 2024-02-26 14:40:20 | 2024-02-26 14:40:21 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "templates/debug.h"
#else
#define dbg(...) (void)0
#define msg(...) (void)0
#endif
#define ll long long
#define PB emplace_back
#define PPB pop_back
#define MP make_pair
#define ALL(Name) Name.begin(),Name.end()
#define PII pair<int,int>
#define VI vector<int>
#define fi first
#define se second
int main()
{
ios::sync_with_stdio(false),cin.tie(nullptr);
// int _;cin>>_;while(_--)
int n;
cin>>n;
vector<VI>idp;
vector<PII>g;
for(int i=1;i<=n;i++)
{
int ins=idp.size();
for(int j=0;j<idp.size();j++)
{
set<int>st(ALL(idp[j]));
while(!st.empty())
{
cout<<"? ";
for(int k:st)cout<<k<<" ";
cout<<i<<endl;
int x,y;
cin>>x>>y;
if(~x)
{
g.PB(x,y);
if(x>y)swap(x,y);
st.erase(x);
}
else break;
}
if(st.size()==idp[j].size())ins=j;
}
if(idp.size()==ins)idp.PB(VI());
idp[ins].PB(i);
}
cout<<"! "<<g.size()<<endl;
for(auto i:g)cout<<i.fi<<" "<<i.se<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3776kb
input:
3 -1 -1 -1 -1
output:
? 1 2 ? 1 2 3 ! 0
result:
wrong answer unknown token 3