QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#586339#4218. Hidden GraphciuimAC ✓321ms51424kbC++143.0kb2024-09-24 10:58:222024-09-24 10:58:24

Judging History

你现在查看的是最新测评结果

  • [2024-09-24 10:58:24]
  • 评测
  • 测评结果:AC
  • 用时:321ms
  • 内存:51424kb
  • [2024-09-24 10:58:22]
  • 提交

answer

bool M1;
#define look_memory cerr<<abs(&M2-&M1)/1024.0/1024<<" MB\n"
#define look_time cerr<<(clock()-Time)*1.0/CLOCKS_PER_SEC<<'\n'
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <cstring>
#include <array>
#include <algorithm>
#include <queue>
#include <vector>
#include <bitset>
#include <ctime>
#include <cstdlib>
#include <random>
#include <set>
#include <ctime>
#include <map>
#include <stack>
#include <unordered_map>
#include <assert.h>
#define i128 __int128
#define ll long long
#define uint unsigned
#define ull unsigned long long
#define fo(a,b,c) for(ll a=b;a<=c;++a)
#define re(a,b,c) for(ll a=b;a>=c;--a)
#define pii pair<ll,ll>
#define pdd pair<db,db>
#define fi first
#define pb push_back
#define se second
#define ite set<pii> ::iterator
#define vite vector<ll> ::iterator
using namespace std;
const ll mod=998244353;
inline ll gi()
{
	ll x = 0, f = 1;
	char ch = getchar();
	while(ch < '0' || ch > '9')
	{
		if (ch == '-')
			f = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9')
	{
		x = (x<<1) + (x<<3) + (ch^48);
		ch = getchar();
	}
	return x * f;
}
ll _=1;
const ll inf=2e17+5,iinf=2e9;
const ll N=3005;
ll n;
vector<ll> vec[N];
ll ot(vector<ll> z,ll id)
{
	ll sz=z.size();
	sz++;
	cout<<"? "<<sz<<" ";
	for(ll x:z) cout<<x<<" ";
	cout<<id<<'\n';
	fflush(stdout);
	ll x=gi(),y=gi();
	if(x==id) return y;
	return x;
}
vector<ll> g[N];
ll d[N],lk[N][N],vis[N],col[N],buk[N],k,cnt=0;
struct st
{
	bool operator()(pii za,pii zb)
	{
		return za.fi>zb.fi;
	}
};
void wk(ll len)
{
	cnt=0;
	fo(i,1,len) d[i]=g[i].size(),vis[i]=0,col[i]=0;
	priority_queue<pii,vector<pii>,st> s;
	fo(i,1,len) s.push({d[i],i}),k=max(k,d[i]+1);
	vector<ll> od;
	while(!s.empty())
	{
		pii p=s.top();
		s.pop();
		ll u=p.se;
		if(vis[u]) continue;
		vis[u]=1;
		od.pb(u);
		for(ll v:g[u])
		{
			if(vis[v]) continue;
			d[v]--;
			s.push({d[v],v});
		}
	}
	while(od.size())
	{
		ll u=od.back();
		od.pop_back();
		ll sz=g[u].size();
		fo(i,1,k) buk[i]=0;
		for(ll v:g[u])
		{
			buk[col[v]]=1;
		}
		fo(i,1,k)
		{
			if(buk[i]==0)
			{
				col[u]=i;
				vec[col[u]].pb(u);
				cnt=max(cnt,i);
				break;
			}
		}
	}
//	cout<<"WK "<<len<<" "<<cnt<<'\n';
}
void sol()
{
	n=gi();
	cnt=1;
	vec[1].pb(1);
	k=1;
	fo(i,2,n)
	{
		fo(j,1,cnt)
		{
			while(1)
			{
				if(vec[j].empty()) break;
				ll p=ot(vec[j],i);
				if(p==-1)
				{
					break;
				}
				g[i].pb(p);
				g[p].pb(i);
				lk[i][p]=lk[p][i]=1;
				vector<ll> zs;
				for(ll x:vec[j])
				{
					if(x==p) continue;
					zs.pb(x);
				}
				vec[j]=zs;
			}
		}
		fo(j,1,cnt) vec[j].clear();
		wk(i);
	}
	ll num=0;
	fo(i,1,n)
	{
		fo(j,i+1,n)
		{
			if(lk[i][j]) num++;
		}
	}
	cout<<"! "<<num<<'\n';
	fo(i,1,n)
	{
		fo(j,i+1,n)
		{
			if(lk[i][j]) cout<<i<<" "<<j<<'\n';
		}
	}
	fflush(stdout);
}
bool M2;
int main()
{
	int Time=clock();
	look_memory;
//	_=gi();
	while(_--)
	{
		sol();
		printf("\n");
	}
	look_time;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 5992kb

input:

3
1 2
2 3
1 3

output:

? 2 1 2
? 2 2 3
? 2 1 3
! 3
1 2
1 3
2 3


result:

ok correct

Test #2:

score: 0
Accepted
time: 1ms
memory: 4072kb

input:

10
1 2
-1 -1
1 3
1 4
-1 -1
-1 -1
2 5
4 5
-1 -1
2 6
-1 -1
-1 -1
-1 -1
3 7
-1 -1
3 8
4 8
-1 -1
-1 -1
-1 -1
3 9
-1 -1
-1 -1
4 10
3 10
-1 -1

output:

? 2 1 2
? 2 2 3
? 2 1 3
? 2 1 4
? 3 3 2 4
? 2 1 5
? 4 4 3 2 5
? 3 4 3 5
? 2 3 5
? 4 4 2 3 6
? 3 4 3 6
? 3 5 1 6
? 4 5 1 6 7
? 4 4 2 3 7
? 3 4 2 7
? 4 4 2 3 8
? 3 4 2 8
? 2 2 8
? 5 5 1 7 6 8
? 6 1 8 5 7 6 9
? 4 4 3 2 9
? 3 4 2 9
? 7 1 8 5 9 7 6 10
? 4 4 3 2 10
? 3 3 2 10
? 2 2 10
! 12
1 2
1 3
1 4
2 5...

result:

ok correct

Test #3:

score: 0
Accepted
time: 0ms
memory: 4036kb

input:

5
2 1
3 2
3 1
-1 -1
4 2
4 1
5 1
5 2
-1 -1

output:

? 2 1 2
? 2 2 3
? 2 1 3
? 2 3 4
? 2 2 4
? 2 1 4
? 2 1 5
? 2 2 5
? 3 4 3 5
! 7
1 2
1 3
1 4
1 5
2 3
2 4
2 5


result:

ok correct

Test #4:

score: 0
Accepted
time: 1ms
memory: 6256kb

input:

3
2 1
-1 -1
1 3

output:

? 2 1 2
? 2 2 3
? 2 1 3
! 2
1 2
1 3


result:

ok correct

Test #5:

score: 0
Accepted
time: 1ms
memory: 4272kb

input:

6
1 2
3 2
3 1
3 4
4 2
-1 -1
2 5
3 5
4 5
-1 -1
-1 -1
-1 -1
3 6
-1 -1

output:

? 2 1 2
? 2 2 3
? 2 1 3
? 2 3 4
? 2 2 4
? 2 1 4
? 2 2 5
? 2 3 5
? 3 4 1 5
? 2 1 5
? 3 5 1 6
? 2 2 6
? 2 3 6
? 2 4 6
! 9
1 2
1 3
2 3
2 4
2 5
3 4
3 5
3 6
4 5


result:

ok correct

Test #6:

score: 0
Accepted
time: 1ms
memory: 4296kb

input:

27
-1 -1
3 1
3 2
-1 -1
-1 -1
3 5
-1 -1
1 5
2 5
-1 -1
-1 -1
6 1
-1 -1
-1 -1
-1 -1
-1 -1
6 8
-1 -1
-1 -1
1 8
-1 -1
-1 -1
-1 -1
1 9
-1 -1
10 8
-1 -1
-1 -1
-1 -1
4 11
5 11
-1 -1
6 11
-1 -1
1 11
-1 -1
12 11
-1 -1
-1 -1
5 12
-1 -1
8 13
-1 -1
10 13
-1 -1
6 13
5 13
14 8
-1 -1
14 1
14 12
-1 -1
14 5
6 14
-1 -...

output:

? 2 1 2
? 3 2 1 3
? 2 2 3
? 2 3 4
? 3 2 1 4
? 3 3 4 5
? 2 4 5
? 3 2 1 5
? 2 2 5
? 3 5 4 6
? 2 3 6
? 3 2 1 6
? 2 2 6
? 4 5 6 4 7
? 2 3 7
? 3 1 2 7
? 5 5 6 7 4 8
? 4 5 7 4 8
? 2 3 8
? 3 1 2 8
? 2 2 8
? 5 5 8 7 4 9
? 3 3 6 9
? 3 1 2 9
? 2 2 9
? 6 5 8 9 7 4 10
? 5 5 9 7 4 10
? 3 3 6 10
? 3 1 2 10
? 6 5 ...

result:

ok correct

Test #7:

score: 0
Accepted
time: 3ms
memory: 4232kb

input:

47
-1 -1
-1 -1
-1 -1
5 4
5 3
-1 -1
-1 -1
-1 -1
7 5
7 6
-1 -1
-1 -1
5 8
-1 -1
-1 -1
-1 -1
9 4
-1 -1
10 7
-1 -1
-1 -1
11 1
-1 -1
7 11
-1 -1
11 12
2 12
5 12
-1 -1
7 12
12 3
-1 -1
-1 -1
13 7
-1 -1
13 11
13 5
-1 -1
-1 -1
-1 -1
13 15
4 15
-1 -1
-1 -1
-1 -1
16 1
-1 -1
-1 -1
-1 -1
17 8
17 1
-1 -1
17 7
17 3
...

output:

? 2 1 2
? 3 2 1 3
? 4 3 2 1 4
? 5 4 2 3 1 5
? 4 2 3 1 5
? 3 2 1 5
? 4 5 2 1 6
? 3 4 3 6
? 5 5 2 6 1 7
? 4 2 6 1 7
? 3 2 1 7
? 3 4 3 7
? 5 5 6 2 1 8
? 4 6 2 1 8
? 4 7 4 3 8
? 5 5 6 2 1 9
? 5 8 7 4 3 9
? 4 8 7 3 9
? 7 4 7 8 3 2 1 10
? 6 4 8 3 2 1 10
? 4 5 9 6 10
? 7 5 10 9 6 2 1 11
? 6 5 10 9 6 2 11
?...

result:

ok correct

Test #8:

score: 0
Accepted
time: 2ms
memory: 4252kb

input:

38
-1 -1
-1 -1
4 1
-1 -1
3 5
4 5
-1 -1
1 5
-1 -1
4 6
-1 -1
-1 -1
6 7
7 5
2 7
4 7
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
4 10
-1 -1
-1 -1
-1 -1
11 4
-1 -1
-1 -1
11 1
-1 -1
11 12
12 8
-1 -1
-1 -1
12 7
-1 -1
11 13
13 8
-1 -1
4 13
13 12
-1 -1
13 1
-1 -1
3 14
-1 -1
11 14
14 5
6 14
-1 -1
-1 -1
1 ...

output:

? 2 1 2
? 3 2 1 3
? 4 3 2 1 4
? 3 3 2 4
? 4 4 3 2 5
? 3 4 2 5
? 2 2 5
? 2 1 5
? 3 5 2 6
? 3 4 3 6
? 2 3 6
? 2 1 6
? 4 5 6 2 7
? 3 5 2 7
? 2 2 7
? 3 4 3 7
? 2 3 7
? 2 1 7
? 4 4 3 2 8
? 3 5 6 8
? 3 7 1 8
? 5 4 2 3 8 9
? 3 5 6 9
? 3 7 1 9
? 6 4 2 3 9 8 10
? 5 2 3 9 8 10
? 3 5 6 10
? 3 7 1 10
? 6 4 2 3 ...

result:

ok correct

Test #9:

score: 0
Accepted
time: 1ms
memory: 4064kb

input:

25
-1 -1
-1 -1
-1 -1
5 4
5 2
-1 -1
-1 -1
6 4
-1 -1
5 7
7 3
-1 -1
-1 -1
5 8
-1 -1
2 8
4 8
-1 -1
9 8
-1 -1
-1 -1
2 9
9 4
-1 -1
10 3
-1 -1
-1 -1
2 11
10 11
-1 -1
-1 -1
9 11
-1 -1
12 4
-1 -1
6 12
-1 -1
-1 -1
6 13
5 13
-1 -1
13 8
7 13
-1 -1
-1 -1
14 13
14 4
-1 -1
7 14
-1 -1
14 3
5 14
-1 -1
-1 -1
10 15
-1...

output:

? 2 1 2
? 3 2 1 3
? 4 3 2 1 4
? 5 4 2 3 1 5
? 4 2 3 1 5
? 3 3 1 5
? 4 5 3 1 6
? 3 4 2 6
? 2 2 6
? 5 5 6 3 1 7
? 4 6 3 1 7
? 3 6 1 7
? 3 4 2 7
? 5 5 6 3 1 8
? 4 6 3 1 8
? 4 2 4 7 8
? 3 4 7 8
? 2 7 8
? 5 8 7 6 1 9
? 4 7 6 1 9
? 3 5 3 9
? 3 2 4 9
? 2 4 9
? 5 2 4 7 1 10
? 4 8 6 3 10
? 3 8 6 10
? 3 9 5 1...

result:

ok correct

Test #10:

score: 0
Accepted
time: 1ms
memory: 4092kb

input:

6
-1 -1
2 3
-1 -1
-1 -1
-1 -1
-1 -1
2 5
-1 -1
5 6
-1 -1

output:

? 2 1 2
? 3 2 1 3
? 2 1 3
? 3 3 1 4
? 2 2 4
? 4 3 4 1 5
? 2 2 5
? 4 2 4 1 6
? 3 5 3 6
? 2 3 6
! 3
2 3
2 5
5 6


result:

ok correct

Test #11:

score: 0
Accepted
time: 1ms
memory: 4248kb

input:

3
2 1
2 3
3 1

output:

? 2 1 2
? 2 2 3
? 2 1 3
! 3
1 2
1 3
2 3


result:

ok correct

Test #12:

score: 0
Accepted
time: 1ms
memory: 6216kb

input:

3
2 1
-1 -1
3 1

output:

? 2 1 2
? 2 2 3
? 2 1 3
! 2
1 2
1 3


result:

ok correct

Test #13:

score: 0
Accepted
time: 1ms
memory: 4096kb

input:

5
2 1
2 3
3 1
-1 -1
-1 -1
-1 -1
5 1
-1 -1
2 5
-1 -1

output:

? 2 1 2
? 2 2 3
? 2 1 3
? 2 3 4
? 2 2 4
? 2 1 4
? 3 1 4 5
? 2 4 5
? 2 2 5
? 2 3 5
! 5
1 2
1 3
1 5
2 3
2 5


result:

ok correct

Test #14:

score: 0
Accepted
time: 1ms
memory: 4120kb

input:

3
2 1
-1 -1
-1 -1

output:

? 2 1 2
? 2 2 3
? 2 1 3
! 1
1 2


result:

ok correct

Test #15:

score: 0
Accepted
time: 0ms
memory: 4328kb

input:

5
-1 -1
-1 -1
4 3
-1 -1
2 5
3 5
-1 -1
-1 -1

output:

? 2 1 2
? 3 2 1 3
? 4 3 2 1 4
? 3 2 1 4
? 4 3 2 1 5
? 3 3 1 5
? 2 1 5
? 2 4 5
! 3
2 5
3 4
3 5


result:

ok correct

Test #16:

score: 0
Accepted
time: 0ms
memory: 8444kb

input:

93
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
10 9
-1 -1
7 11
-1 -1
-1 -1
2 12
-1 -1
-1 -1
5 13
-1 -1
-1 -1
-1 -1
-1 -1
15 12
-1 -1
-1 -1
6 16
8 16
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
19 18
-1 -1
11 19
-1 -1
-1 -1
20 16
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 23
-1 -1
8 23
-1 -1
-1 -1
-1 -1
1 25
-1 -1
...

output:

? 2 1 2
? 3 2 1 3
? 4 3 2 1 4
? 5 4 2 3 1 5
? 6 4 2 5 3 1 6
? 7 4 2 5 6 3 1 7
? 8 4 2 5 7 6 3 1 8
? 9 4 2 5 8 6 7 3 1 9
? 10 4 2 5 8 6 9 7 3 1 10
? 9 4 2 5 8 6 7 3 1 10
? 10 9 4 5 2 8 6 7 3 1 11
? 9 9 4 5 2 8 6 3 1 11
? 2 10 11
? 10 9 11 8 4 5 2 6 3 1 12
? 9 9 11 8 4 5 6 3 1 12
? 3 10 7 12
? 10 10 2...

result:

ok correct

Test #17:

score: 0
Accepted
time: 6ms
memory: 6468kb

input:

111
-1 -1
-1 -1
-1 -1
-1 -1
2 6
-1 -1
7 4
-1 -1
-1 -1
3 8
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
2 11
-1 -1
4 11
-1 -1
6 12
7 12
12 11
-1 -1
12 4
-1 -1
13 10
-1 -1
7 13
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
17 10
-1 -1
-1 -1
18 5
-1 -1
4 18
-1 -1
-1 -1
16 19
-1 -1
-1 -...

output:

? 2 1 2
? 3 2 1 3
? 4 3 2 1 4
? 5 4 2 3 1 5
? 6 4 2 5 3 1 6
? 5 4 5 3 1 6
? 6 6 5 4 3 1 7
? 5 6 5 3 1 7
? 2 2 7
? 6 7 2 5 3 1 8
? 5 7 2 5 1 8
? 3 4 6 8
? 6 4 2 8 5 1 9
? 4 7 6 3 9
? 7 7 2 8 9 5 1 10
? 4 4 6 3 10
? 8 7 2 8 9 10 5 1 11
? 7 7 8 9 10 5 1 11
? 4 4 6 3 11
? 3 6 3 11
? 9 11 6 7 8 9 10 5 1 ...

result:

ok correct

Test #18:

score: 0
Accepted
time: 6ms
memory: 8228kb

input:

132
-1 -1
3 1
-1 -1
-1 -1
-1 -1
-1 -1
5 1
-1 -1
6 3
-1 -1
7 2
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
10 8
-1 -1
5 10
-1 -1
-1 -1
-1 -1
12 8
-1 -1
-1 -1
9 13
-1 -1
-1 -1
2 14
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
17 15
-1 -1
-1 -1
-1 -1
-1 -1
19 10
17 19
19 6
-1 -1
-1 -1
-1 -1
-1 -1
21 20
-1 -1
-1 -1
22 2...

output:

? 2 1 2
? 3 2 1 3
? 2 2 3
? 3 3 2 4
? 2 1 4
? 4 3 4 2 5
? 2 1 5
? 4 1 4 2 6
? 3 5 3 6
? 2 5 6
? 5 1 6 4 2 7
? 4 1 6 4 7
? 3 3 5 7
? 5 1 2 6 4 8
? 4 5 3 7 8
? 6 1 2 6 8 4 9
? 4 5 3 7 9
? 7 1 2 6 9 8 4 10
? 6 1 2 6 9 4 10
? 4 5 3 7 10
? 3 3 7 10
? 7 5 3 8 2 9 4 11
? 5 1 10 7 6 11
? 8 5 3 8 2 11 9 4 12...

result:

ok correct

Test #19:

score: 0
Accepted
time: 3ms
memory: 6504kb

input:

94
-1 -1
3 2
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
2 7
-1 -1
-1 -1
2 9
-1 -1
7 9
-1 -1
-1 -1
-1 -1
-1 -1
11 6
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
11 13
-1 -1
6 13
-1 -1
-1 -1
14 10
-1 -1
14 11
-1 -1
-1 -1
-1 -1
15 11
-1 -1
-1 -1
15 16
-1 -1
-1 -1
16 7
-1 -1
17 8
17 10
17 11
-1 -1
-1 -1
-1 ...

output:

? 2 1 2
? 3 2 1 3
? 2 1 3
? 3 3 1 4
? 2 2 4
? 4 3 4 1 5
? 2 2 5
? 5 3 5 4 1 6
? 2 2 6
? 6 3 5 4 6 1 7
? 2 2 7
? 6 2 5 4 6 1 8
? 3 7 3 8
? 7 2 8 5 4 6 1 9
? 6 8 5 4 6 1 9
? 3 3 7 9
? 2 3 9
? 8 9 3 8 5 4 6 1 10
? 2 2 10
? 2 7 10
? 9 9 3 8 5 4 10 6 1 11
? 8 9 3 8 5 4 10 1 11
? 2 2 11
? 2 7 11
? 9 9 11 ...

result:

ok correct

Test #20:

score: 0
Accepted
time: 0ms
memory: 6252kb

input:

73
-1 -1
1 3
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
5 7
6 7
-1 -1
-1 -1
-1 -1
3 8
-1 -1
-1 -1
1 9
9 8
-1 -1
3 10
9 10
4 10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 10 5 1 11
? 6 3 4 9 10 5 11
? 5 2 8 7 6 11
? 9 2 1 8 7 6 10 9 5 12...

result:

ok correct

Test #22:

score: 0
Accepted
time: 7ms
memory: 6308kb

input:

81
-1 -1
2 3
-1 -1
-1 -1
2 4
1 5
-1 -1
4 5
-1 -1
4 6
-1 -1
-1 -1
-1 -1
-1 -1
1 8
-1 -1
-1 -1
-1 -1
-1 -1
2 10
10 6
-1 -1
10 4
10 3
-1 -1
-1 -1
-1 -1
11 3
4 11
8 12
-1 -1
6 12
2 12
-1 -1
-1 -1
10 13
-1 -1
-1 -1
-1 -1
10 14
-1 -1
-1 -1
1 14
-1 -1
-1 -1
13 15
-1 -1
-1 -1
11 16
12 16
1 16
-1 -1
13 16
-1...

output:

? 2 1 2
? 3 2 1 3
? 2 1 3
? 3 3 1 4
? 2 2 4
? 3 2 1 5
? 2 2 5
? 3 4 3 5
? 2 3 5
? 4 4 3 1 6
? 3 3 1 6
? 3 2 5 6
? 4 4 3 1 7
? 4 2 5 6 7
? 5 4 3 1 7 8
? 4 4 3 7 8
? 4 2 5 6 8
? 6 5 8 2 6 7 9
? 4 1 4 3 9
? 7 5 8 2 6 9 7 10
? 6 5 8 6 9 7 10
? 5 5 8 9 7 10
? 4 1 4 3 10
? 3 1 3 10
? 2 1 10
? 6 10 5 8 9 7...

result:

ok correct

Test #23:

score: 0
Accepted
time: 6ms
memory: 6252kb

input:

93
-1 -1
-1 -1
4 1
2 4
-1 -1
-1 -1
-1 -1
4 6
-1 -1
-1 -1
-1 -1
2 7
-1 -1
1 8
3 8
-1 -1
-1 -1
9 1
-1 -1
9 8
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
13 7
-1 -1
-1 -1
-1 -1
9 14
4 14
-1 -1
-1 -1
1 14
14 15
-1 -1
-1 -1
-1 -1
13 16
-1 -1
-1 -1
-1 -1
17 3
2 17
17 1
17 5
-1 -1
17 16
-1 ...

output:

? 2 1 2
? 3 2 1 3
? 4 3 2 1 4
? 3 3 2 4
? 2 3 4
? 3 4 3 5
? 3 2 1 5
? 4 4 5 3 6
? 3 5 3 6
? 3 2 1 6
? 4 4 5 3 7
? 4 2 6 1 7
? 3 6 1 7
? 6 2 6 1 5 3 8
? 5 2 6 5 3 8
? 4 2 6 5 8
? 3 4 7 8
? 6 1 2 3 6 5 9
? 5 2 3 6 5 9
? 4 4 8 7 9
? 3 4 7 9
? 6 9 4 3 7 5 10
? 4 1 2 6 10
? 2 8 10
? 7 9 4 3 7 10 5 11
? 4...

result:

ok correct

Test #24:

score: 0
Accepted
time: 1ms
memory: 4176kb

input:

37
-1 -1
3 1
-1 -1
-1 -1
-1 -1
2 5
-1 -1
-1 -1
-1 -1
-1 -1
7 1
-1 -1
2 7
-1 -1
7 8
6 8
4 8
-1 -1
2 8
1 8
9 8
-1 -1
6 9
-1 -1
9 1
2 9
3 10
-1 -1
10 8
1 10
-1 -1
9 11
4 11
7 11
-1 -1
3 11
11 8
2 11
11 1
-1 -1
-1 -1
12 7
-1 -1
12 8
12 1
-1 -1
6 13
12 13
-1 -1
-1 -1
-1 -1
-1 -1
6 14
14 5
-1 -1
-1 -1
14 ...

output:

? 2 1 2
? 3 2 1 3
? 2 2 3
? 3 3 2 4
? 2 1 4
? 4 3 4 2 5
? 3 3 4 5
? 2 1 5
? 4 5 1 4 6
? 3 2 3 6
? 5 5 1 6 4 7
? 4 5 6 4 7
? 3 2 3 7
? 2 3 7
? 6 7 5 3 6 4 8
? 5 5 3 6 4 8
? 4 5 3 4 8
? 3 5 3 8
? 3 2 1 8
? 2 1 8
? 4 8 5 3 9
? 3 5 3 9
? 4 7 4 6 9
? 3 7 4 9
? 3 2 1 9
? 2 2 9
? 6 9 7 5 4 3 10
? 5 9 7 5 4...

result:

ok correct

Test #25:

score: 0
Accepted
time: 4ms
memory: 6332kb

input:

144
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-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 3 1 11
? 12 4 2 5 8 6 9 10 11 7 3 1 12
? 13 4 2 5 8 6 9 10 11 12 7 3 1 13
? 14 4 2 5 8 6 9 10 11 12 13 7 3 1 14
? 15 4 2 5 8 6 9 10 ...

result:

ok correct

Test #27:

score: 0
Accepted
time: 59ms
memory: 20848kb

input:

679
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
39 40
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1...

output:

? 2 1 2
? 3 2 1 3
? 4 3 2 1 4
? 5 4 2 3 1 5
? 6 4 2 5 3 1 6
? 7 4 2 5 6 3 1 7
? 8 4 2 5 7 6 3 1 8
? 9 4 2 5 8 6 7 3 1 9
? 10 4 2 5 8 6 9 7 3 1 10
? 11 4 2 5 8 6 9 10 7 3 1 11
? 12 4 2 5 8 6 9 10 11 7 3 1 12
? 13 4 2 5 8 6 9 10 11 12 7 3 1 13
? 14 4 2 5 8 6 9 10 11 12 13 7 3 1 14
? 15 4 2 5 8 6 9 10 ...

result:

ok correct

Test #28:

score: 0
Accepted
time: 106ms
memory: 29036kb

input:

1000
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
17 27
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-...

output:

? 2 1 2
? 3 2 1 3
? 4 3 2 1 4
? 5 4 2 3 1 5
? 6 4 2 5 3 1 6
? 7 4 2 5 6 3 1 7
? 8 4 2 5 7 6 3 1 8
? 9 4 2 5 8 6 7 3 1 9
? 10 4 2 5 8 6 9 7 3 1 10
? 11 4 2 5 8 6 9 10 7 3 1 11
? 12 4 2 5 8 6 9 10 11 7 3 1 12
? 13 4 2 5 8 6 9 10 11 12 7 3 1 13
? 14 4 2 5 8 6 9 10 11 12 13 7 3 1 14
? 15 4 2 5 8 6 9 10 ...

result:

ok correct

Test #29:

score: 0
Accepted
time: 106ms
memory: 31268kb

input:

1000
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
13 14
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
6 22
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1...

output:

? 2 1 2
? 3 2 1 3
? 4 3 2 1 4
? 5 4 2 3 1 5
? 6 4 2 5 3 1 6
? 7 4 2 5 6 3 1 7
? 8 4 2 5 7 6 3 1 8
? 9 4 2 5 8 6 7 3 1 9
? 10 4 2 5 8 6 9 7 3 1 10
? 11 4 2 5 8 6 9 10 7 3 1 11
? 12 4 2 5 8 6 9 10 11 7 3 1 12
? 13 4 2 5 8 6 9 10 11 12 7 3 1 13
? 14 4 2 5 8 6 9 10 11 12 13 7 3 1 14
? 13 4 2 5 8 6 9 10 ...

result:

ok correct

Test #30:

score: 0
Accepted
time: 321ms
memory: 51424kb

input:

2000
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
44 15
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-...

output:

? 2 1 2
? 3 2 1 3
? 4 3 2 1 4
? 5 4 2 3 1 5
? 6 4 2 5 3 1 6
? 7 4 2 5 6 3 1 7
? 8 4 2 5 7 6 3 1 8
? 9 4 2 5 8 6 7 3 1 9
? 10 4 2 5 8 6 9 7 3 1 10
? 11 4 2 5 8 6 9 10 7 3 1 11
? 12 4 2 5 8 6 9 10 11 7 3 1 12
? 13 4 2 5 8 6 9 10 11 12 7 3 1 13
? 14 4 2 5 8 6 9 10 11 12 13 7 3 1 14
? 15 4 2 5 8 6 9 10 ...

result:

ok correct