QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#137650 | #4218. Hidden Graph | XY_Eleven | WA | 1ms | 3700kb | C++23 | 3.7kb | 2023-08-10 15:39:47 | 2023-08-10 15:39:49 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define DB double
#define LL long long
#define ULL unsigned long long
#define pii pair<int,int>
#define pil pair<int,LL>
#define mii map<int,int>
#define miig map<int,int,greater<int> >
#define mil map<int,LL>
#define in128 __int128
#define cint const int
#define cLL const LL
#define cDB const DB
#define cchar const char
#define invoid inline void
#define inLL inline LL
#define inlint inline int
#define inbool inline bool
#define inl128 inline __int128
#define inDB inline double
#define For(z,e1,e2) for(int z=(e1);z<=(e2);z++)
#define Rof(z,e1,e2) for(int z=(e2);z>=(e1);z--)
#define For_(z,e1,e2) for(int z=(e1);z<(e2);z++)
#define Rof_(z,e1,e2) for(int z=(e2);z>(e1);z--)
#define inint(e) scanf("%d",&e)
#define inll(e) scanf("%lld",&e)
#define inpr(e1,e2) scanf("%d%d",&e1,&e2)
#define in3(e1,e2,e3) scanf("%d%d%d",&e1,&e2,&e3)
#define outint(e) printf("%d\n",e)
#define outint_(e) printf("%d%c",e," \n"[i==n])
#define outll(e) printf("%lld\n",e)
#define outll_(e) printf("%lld%c",e," \n"[i==n])
#define exc(e) if(e) continue
#define stop(e) if(e) break
#define ret(e) if(e) return
#define ll(e) ((LL)(e))
#define pb push_back
#define ft first
#define sc second
#define clean(e) while(!e.empty()) e.pop()
#define all(ev) ev.begin(),ev.end()
#define x0 x00
#define y1 y11
#define debug(x) cerr<<#x<<'='<<x<<'\n'
#define fout fflush(stdout)
invoid input(int &N_,int A_[],bool F_)
{
if(F_) inint(N_);
For(i,1,N_) inint(A_[i]);
}
template <typename Type>
inline Type md(Type w1,const Type w2)
{
w1%=w2; if(w1<0) w1+=w2;
return w1;
}
template <typename Type>
invoid add(Type &w1,const Type w2,const Type M_)
{ w1=md(w1+w2,M_); }
invoid mul(LL &w1,cLL w2,cLL M_)
{ w1=md(w1*w2,M_); }
inLL gcd(LL X_,LL Y_)
{
LL R_=X_%Y_;
while(R_)
{ X_=Y_; Y_=R_; R_=X_%Y_; }
return Y_;
}
invoid ex_gcd(LL &X_,LL &Y_,LL A_,LL B_)
{
if(!B_)
{
X_=1ll; Y_=0ll;
return ;
}
ex_gcd(Y_,X_,B_,A_%B_);
X_=md(X_,B_); Y_=(1ll-X_*A_)/B_;
}
inLL inv(LL A_,LL B_)
{
LL X_=0ll,Y_=0ll;
ex_gcd(X_,Y_,A_,B_);
return X_;
}
inLL pw(LL X_,LL Y_,LL M_)
{
LL S_=1ll;
while(Y_)
{
if(Y_&1) mul(S_,X_,M_);
Y_>>=1;
mul(X_,X_,M_);
}
return S_;
}
template <typename Type>
invoid get_min(Type &w1,const Type w2)
{ if(w2<w1) w1=w2; }
template <typename Type>
invoid get_max(Type &w1,const Type w2)
{ if(w2>w1) w1=w2; }
//inLL A(cint N_,cint M_)
//{ return (N_>=M_?md(d1[N_]*d2[N_-M_],mod):0ll); }
//inLL C(cint N_,cint M_)
//{ return (N_>=M_?md(d1[N_]*md(d2[M_]*d2[N_-M_],mod),mod):0ll); }
//mt19937 gen(time(NULL));
//mt19937_64 gen(time(NULL));
//cLL base[]={166686661,188868881},mod[]={1686688681,1666868881};
//cLL mod[]={1e9+7,1e9+9,1e9+21,1e9+33};
cint N=2100;
int n;
vector <pii> edge;
vector <vector <int> > v;
vector <int> t;
inbool work(int x)
{
if(t.empty()) return false;
printf("? ");
for(auto i:t)
printf("%d ",i);
outint(x);
fout;
int a,b;
inpr(a,b);
if(!~a) return false;
edge.pb({a,b});
if(a==x) swap(a,b);
t.erase(find(all(t),a));
return true;
}
int main()
{
inint(n);
For(x,1,n)
{
bool f=false;
for(auto &S:v)
{
bool ok=true;
t=S;
while(work(x)) ok=false;
if(ok&&(!f))
{
f=true;
S.pb(x);
}
}
if(!f) v.pb({x});
}
printf("! %d\n",(int)edge.size());
for(auto [x,y]:edge)
printf("%d %d\n",x,y);
fout;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3700kb
input:
3 -1 -1 -1 -1
output:
? 1 2 ? 1 2 3 ! 0
result:
wrong answer unknown token 3