QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#339076#4218. Hidden GraphYMH_fourteenTL 644ms4012kbC++141.8kb2024-02-26 18:30:312024-02-26 18:30:31

Judging History

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

  • [2024-02-26 18:30:31]
  • 评测
  • 测评结果:TL
  • 用时:644ms
  • 内存:4012kb
  • [2024-02-26 18:30:31]
  • 提交

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>g;
	g.PB(VI());
	auto work=[&](int x,VI &ord)->bool
	{
		ord.clear();
		int _n=g.size();
		VI ds(_n);
		for(int i=0;i<_n;i++)
			ds[i]=g[i].size();
		for(int i=0;i<_n;i++)
		{
			int id=-1;
			for(int j=0;j<_n;j++)
				if(ds[j]<=x){id=j;break;}
			if(!~id)return 0;
			ord.PB(id);
			ds[id]=INT_MAX;
			for(int j:g[id])ds[j]--;
		}
		return 1;
	};

	for(int i=1;i<n;i++)
	{
		VI ord;
		int l=1,r=i;
		while(l<=r)
		{
			int mid=l+r>>1;
			work(mid-1,ord)?r=mid-1:l=mid+1;
		}
		assert(work(l-1,ord));
		reverse(ALL(ord));
		VI col(i);col.assign(i,-1);
		for(int j:ord)
		{
			set<int>nex;
			for(int k=0;k<=l;k++)nex.insert(k);
			for(int k:g[j])nex.erase(col[k]);
			col[j]=*nex.begin();
		}
		g.PB(VI());
		for(int j=0;j<=l;j++)
		{
			set<int>st;
			for(int k=0;k<i;k++)
				if(col[k]==j)st.insert(k);
			while(!st.empty())
			{
				cout<<"? "<<st.size()+1<<" ";
				for(int j:st)cout<<j+1<<" ";
				cout<<i+1<<endl;
				int x,y;
				cin>>x>>y;
				if(~x)
				{
					--x,--y;
					if(x>y)swap(x,y);
					g[x].PB(y),g[y].PB(x);
					st.erase(x);
				}
				else break;
			}
		}
	}
	int sum=0;
	for(auto i:g)sum+=i.size();
	cout<<"! "<<sum/2<<endl;
	for(int i=0;i<n;i++)
		for(int j:g[i])
			if(i<j)cout<<i+1<<" "<<j+1<<endl;

	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3592kb

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: 0ms
memory: 3648kb

input:

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

result:

ok correct

Test #3:

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

input:

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

output:

? 2 1 2
? 2 2 3
? 2 1 3
? 2 3 4
? 2 2 4
? 2 1 4
? 3 3 4 5
? 2 2 5
? 2 1 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: 3648kb

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: 3856kb

input:

6
1 2
3 2
3 1
3 4
4 2
-1 -1
4 5
-1 -1
3 5
2 5
-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
? 3 1 4 5
? 2 1 5
? 2 3 5
? 2 2 5
? 3 1 5 6
? 2 4 6
? 2 3 6
? 2 2 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: 2ms
memory: 3896kb

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

output:

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

result:

ok correct

Test #7:

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

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
-1 -1
5 8
-1 -1
9 4
-1 -1
-1 -1
-1 -1
10 7
-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 11
13 5
-1 -1
13 7
-1 -1
-1 -1
-1 -1
-1 -1
13 15
-1 -1
-1 -1
4 15
-1 -1
16 1
-1 -1
-1 -1
-1 -1
-1 -1
17 8
17 16
-1 ...

output:

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

result:

ok correct

Test #8:

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

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
-1 -1
-1 -1
4 10
11 1
-1 -1
11 4
-1 -1
-1 -1
12 8
11 12
-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
-1 -1
11 14
14 5
6 14
-1 -1
1 14
-1 ...

output:

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

result:

ok correct

Test #9:

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

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

output:

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

result:

ok correct

Test #10:

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

input:

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

output:

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

result:

ok correct

Test #11:

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

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: 3816kb

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: 3596kb

input:

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

output:

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

result:

ok correct

Test #14:

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

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: 1ms
memory: 3588kb

input:

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

output:

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

result:

ok correct

Test #16:

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

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
11 19
-1 -1
-1 -1
20 16
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 23
8 23
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 25
...

output:

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

result:

ok correct

Test #17:

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

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
-1 -1
2 11
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
-1 -1
4 18
16 19
-1 -1
11 19
-1 -...

output:

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

result:

ok correct

Test #18:

score: 0
Accepted
time: 9ms
memory: 3912kb

input:

132
-1 -1
3 1
-1 -1
-1 -1
-1 -1
-1 -1
5 1
6 3
-1 -1
-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
-1 -1
12 8
-1 -1
9 13
-1 -1
-1 -1
-1 -1
2 14
-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
-1 -1
21 20
-1 -1
-1 -...

output:

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

result:

ok correct

Test #19:

score: 0
Accepted
time: 5ms
memory: 3708kb

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
7 9
-1 -1
2 9
-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
16 7
-1 -1
-1 -1
17 8
-1 -1
17 10
-1 -1
17 11
-1 -1
-1 ...

output:

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

result:

ok correct

Test #20:

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

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

output:

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

result:

ok correct

Test #21:

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

input:

77
-1 -1
3 2
-1 -1
-1 -1
2 4
-1 -1
-1 -1
3 6
-1 -1
-1 -1
-1 -1
3 7
-1 -1
-1 -1
3 8
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 11
-1 -1
-1 -1
-1 -1
-1 -1
8 13
-1 -1
-1 -1
-1 -1
2 14
14 8
14 7
-1 -1
3 15
-1 -1
15 8
2 15
-1 -1
16 15
-1 -1
16 8
16 1
2 16
-1 -1
-1 -1
-1 -1
7 17
-1 -1
2 17
-1 -1
-1 -1
-1 -1
-1 -1
-1...

output:

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

result:

ok correct

Test #22:

score: 0
Accepted
time: 11ms
memory: 3556kb

input:

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

output:

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

result:

ok correct

Test #23:

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

input:

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

result:

ok correct

Test #25:

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

input:

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

result:

ok correct

Test #26:

score: 0
Accepted
time: 128ms
memory: 3680kb

input:

561
-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
26 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 -1
-1 -1
-1 -1
-1 -1
-1...

output:

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

result:

ok correct

Test #27:

score: 0
Accepted
time: 219ms
memory: 3700kb

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

result:

ok correct

Test #28:

score: 0
Accepted
time: 644ms
memory: 4012kb

input:

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

result:

ok correct

Test #30:

score: -100
Time Limit Exceeded

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

result: