QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#110997#4218. Hidden GraphRetrieve_72RE 379ms4040kbC++143.9kb2023-06-05 11:07:282023-06-05 11:07:30

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-05 11:07:30]
  • 评测
  • 测评结果:RE
  • 用时:379ms
  • 内存:4040kb
  • [2023-06-05 11:07:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define fi first
#define se second 
#define deb(var) cerr << #var << '=' << var << "; "
#define int long long
namespace SUB {
	int n, tot;
	set<int> sub[2010], tmp; vector<pii> g;
	int main() {
		srand(time(0));
		tot = 1; sub[1].insert(1);
		for (int i = 2; i <= n; i++) {
			int ok = 0;
			for (int j = 1; j <= tot; j++) {
				cout << "? " << sub[j].size() + 1 << " " << i << " ";
				tmp = sub[j];
				for (set<int>::iterator it = tmp.begin(); it != tmp.end(); it++) cout << *it << " "; cout << endl;
				int u, v;
				cin >> u >> v;
				if (u != i) swap(u, v);
				if (u == -1 && v == -1) {
					if (!ok) ok = j;
					else if (rand() % 2) ok = j;
				}
				else {
					g.pb(mp(u, v));
					while (true) {
						tmp.erase(v);
						if (tmp.empty()) break;
						cout << "? " << tmp.size() + 1 << " " << i << " ";
						for (set<int>::iterator it = tmp.begin(); it != tmp.end(); it++) cout << *it << " "; cout << endl;
						cin >> u >> v;
						if (u != i) swap(u, v); 
						if (v != -1) {
							g.pb(mp(u, v));
						} else break;
					}
				}
			}
			if (ok) sub[ok].insert(i); else sub[++tot].insert(i);
		}
		cout << "! " << g.size() << endl;
		for (int i = 0; i < g.size(); i++) cout << g[i].fi << " " << g[i].se << endl;
		return 0;
	}
} 
int n, m, tot, ind[2010], lnd[2010], col[2010];
set<int> sub[2010], tmp; vector<int> g[2010]; vector<int> c; 
	set<pii> st; 
	int ord[2010], len;
void getsub(int n) {
	st.clear();
	for (int i = 1; i <= n; i++)
		st.insert(mp(ind[i], i));
	memcpy(lnd, ind, sizeof lnd);
	memset(col, 0, sizeof col); tot = 0;
	len = 0;
	while (st.size()) {
		set<pii>::iterator it = st.end(); it--;
		int u = (*it).se; ord[++len] = u; ind[u] = 0; st.erase(it);
		for (int j = 0; j < g[u].size(); j++) {
			if (ind[g[u][j]]) {
				st.erase(mp(ind[g[u][j]], g[u][j])); ind[g[u][j]]--; st.insert(mp(ind[g[u][j]], g[u][j]));
			}
		}
	}
	for (int i = len; i >= 1; i--) {
		int u = ord[i];
		c.clear();
		for (int j = 0; j < g[u].size(); j++) {
			if (col[g[u][j]]) c.pb(col[g[u][j]]);
		}
		sort(c.begin(), c.end());
		int lst = 0, now = 0;
		for (int i = 0; i < c.size(); i++)
			if (c[i] > lst + 1) {
				now = lst + 1; break;
			} else lst = c[i];
		col[u] = now;
		if (!now) col[u] = (c.size() ? c[c.size() - 1] + 1 : 1); tot = max(tot, col[u]);
	}
	memcpy(ind, lnd, sizeof lnd);
}
signed main() {
//	g[1].pb(2); g[1].pb(3);g[2].pb(1);g[3].pb(1);g[2].pb(5);g[5].pb(2);ind[1]=2;ind[2]=ind[3]=1;ind[2]++;ind[5]++; 
//	getsub(5);
//	for (int i=1;i<=5;i++)cout<<col[i]<<" ";
	cin >> n;
//	if ((n * n) <= 20000) {
//		SUB::n = n;
//		return SUB::main();
//	}
	tot = 1; sub[1].insert(1);
	for (int i = 2; i <= n; i++) {
		for (int j = 1; j <= tot; j++) {
			if (sub[j].empty()) continue;
			cout << "? " << sub[j].size() + 1 << " " << i << " ";
			tmp = sub[j];
			for (set<int>::iterator it = tmp.begin(); it != tmp.end(); it++) cout << *it << " "; cout << endl;
			int u, v;
			cin >> u >> v;
			if (u != i) swap(u, v);
			if (u == -1 && v == -1) {
			}
			else {
				g[u].pb(v), g[v].pb(u); m++; ind[u]++, ind[v]++;
				while (true) {
					tmp.erase(v);
					if (tmp.empty()) break;
					cout << "? " << tmp.size() + 1 << " " << i << " ";
					for (set<int>::iterator it = tmp.begin(); it != tmp.end(); it++) cout << *it << " "; cout << endl;
					cin >> u >> v;
					if (u != i) swap(u, v); 
					if (v != -1) {
						g[u].pb(v), g[v].pb(u); m++; ind[u]++, ind[v]++;
					} else break;
				}
			}
		}
		for (int i = 1; i <= tot; i++) sub[i].clear();
		getsub(i);
		for (int j = 1; j <= i; j++) sub[col[j]].insert(j);
	}
	cout << "! " << m << endl;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < g[i].size(); j++)
			if (g[i][j] > i) cout << i << " " << g[i][j] << endl;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3876kb

input:

3
1 2
1 3
2 3

output:

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

result:

ok correct

Test #2:

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

input:

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

output:

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

result:

ok correct

Test #3:

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

input:

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

output:

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

result:

ok correct

Test #4:

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

input:

3
2 1
1 3
-1 -1

output:

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

result:

ok correct

Test #5:

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

input:

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

output:

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

input:

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

output:

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

result:

ok correct

Test #7:

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

input:

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

output:

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

result:

ok correct

Test #8:

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

input:

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

output:

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

result:

ok correct

Test #9:

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

input:

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

output:

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

result:

ok correct

Test #10:

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

input:

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

output:

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

result:

ok correct

Test #11:

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

input:

3
2 1
3 1
2 3

output:

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

result:

ok correct

Test #12:

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

input:

3
2 1
3 1
-1 -1

output:

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

result:

ok correct

Test #13:

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

input:

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

output:

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

result:

ok correct

Test #14:

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

input:

3
2 1
-1 -1
-1 -1

output:

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

result:

ok correct

Test #15:

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

input:

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

output:

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

result:

ok correct

Test #16:

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

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
-1 -1
15 12
-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 -1
-1 -1
-1 -1
8 23
1 23
-1 -1
-1 -1
-1 -1...

output:

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

result:

ok correct

Test #17:

score: 0
Accepted
time: 27ms
memory: 3840kb

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
4 11
-1 -1
-1 -1
12 4
-1 -1
6 12
7 12
12 11
-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
17 10
-1 -1
-1 -1
-1 -1
4 18
18 5
-1 -1
-1 -1
-1 -1
16 19
11 19
-1 -...

output:

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

result:

ok correct

Test #18:

score: 0
Accepted
time: 31ms
memory: 3796kb

input:

132
-1 -1
3 1
-1 -1
-1 -1
-1 -1
5 1
-1 -1
-1 -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
-1 -1
-1 -1
9 13
-1 -1
-1 -1
-1 -1
2 14
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
17 15
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
19 6
-1 -...

output:

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

result:

ok correct

Test #19:

score: 0
Accepted
time: 34ms
memory: 3876kb

input:

94
-1 -1
3 2
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
2 7
-1 -1
-1 -1
-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
6 13
-1 -1
11 13
-1 -1
-1 -1
14 10
-1 -1
14 11
-1 -1
-1 -1
-1 -1
-1 -1
15 11
-1 -1
15 16
16 7
-1 -1
-1 -1
-1 -1
17 8
17 10
-1 -1
-1 -1
17 11
-1 ...

output:

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

result:

ok correct

Test #20:

score: 0
Accepted
time: 14ms
memory: 3820kb

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

output:

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

result:

ok correct

Test #21:

score: 0
Accepted
time: 20ms
memory: 3848kb

input:

77
-1 -1
3 2
-1 -1
2 4
-1 -1
-1 -1
-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
2 14
14 8
14 7
-1 -1
-1 -1
2 15
15 8
-1 -1
3 15
-1 -1
16 1
16 8
2 16
-1 -1
16 15
-1 -1
-1 -1
7 17
-1 -1
-1 -1
2 17
-1 -1
-1 -1
-1 -1
-1...

output:

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

result:

ok correct

Test #22:

score: 0
Accepted
time: 12ms
memory: 3780kb

input:

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

output:

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

result:

ok correct

Test #23:

score: 0
Accepted
time: 15ms
memory: 3784kb

input:

93
-1 -1
-1 -1
4 1
2 4
-1 -1
-1 -1
-1 -1
-1 -1
4 6
2 7
-1 -1
-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
-1 -1
13 7
-1 -1
-1 -1
1 14
-1 -1
4 14
9 14
-1 -1
-1 -1
-1 -1
14 15
-1 -1
-1 -1
13 16
-1 -1
-1 -1
-1 -1
17 3
17 16
17 1
2 17
17 5
-1 -1
-1 ...

output:

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

result:

ok correct

Test #24:

score: 0
Accepted
time: 18ms
memory: 3832kb

input:

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

output:

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

result:

ok correct

Test #25:

score: 0
Accepted
time: 13ms
memory: 3900kb

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

result:

ok correct

Test #26:

score: 0
Accepted
time: 159ms
memory: 3860kb

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

result:

ok correct

Test #27:

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

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

result:

ok correct

Test #28:

score: 0
Accepted
time: 368ms
memory: 3940kb

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

result:

ok correct

Test #29:

score: 0
Accepted
time: 379ms
memory: 4040kb

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

result:

ok correct

Test #30:

score: -100
Runtime Error

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

result: