Submission details
Task:Piiri
Sender:aatukaj
Submission time:2025-01-18 16:46:33 +0200
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
#40
Test results
testverdicttimegroup
#10.04 s1, 2, 4details
#20.04 s1, 2, 4details
#30.04 s1, 2, 4details
#40.04 s1, 2, 4details
#50.04 s1, 2, 4details
#60.04 s1, 2, 4details
#70.04 s1, 2, 4details
#80.04 s1, 2, 4details
#90.04 s1, 2, 4details
#100.04 s2, 4details
#110.04 s2, 4details
#120.04 s2, 4details
#130.04 s2, 4details
#140.04 s2, 4details
#150.04 s2, 4details
#160.04 s2, 4details
#170.04 s3details
#180.04 s3details
#190.04 s3details
#200.04 s3details
#210.04 s3details
#220.04 s4details
#230.04 s4details
#240.04 s4details
#250.04 s4details
#260.04 s4details
#270.04 s4details
#280.04 s4details

Compiler report

input/code.cpp: In function 'int check(int, int, int)':
input/code.cpp:29:13: warning: unused variable 'l' [-Wunused-variable]
   29 |         int l = a-1;
      |             ^
input/code.cpp:30:13: warning: unused variable 'm' [-Wunused-variable]
   30 |         int m = b-a;
      |             ^
input/code.cpp:31:1: warning: no return statement in function returning non-void [-Wreturn-type]
   31 | }
      | ^

Code

#include <bits/stdc++.h> 
#define all(v) (v).begin(), (v).end()
using namespace std;
const int maxN = 2e5+10;

int mn[1001][1001];
void ch(int &a, int x) {
	if (a==0) a=x;
}

void precalc() {
	for (int n=1; n<=3000; n++) {
		queue<int> q;
		for (int i=1; i<=n; i++) q.push(i);
		int prev = 0;
		while (!q.empty()) {
			q.push(q.front());
			q.pop();
			int cur = q.front(); q.pop();
			if (prev <=1000 && cur<=1000) {
				ch(mn[prev][cur], n);
			}
			prev = cur;
			
		}
	}
}
int check(int a, int b, int n) {
	int l = a-1;
	int m = b-a;
}
void solve() {
	int a, b;
	cin >> a >> b;
	if (a<=1000 && b<=1000) {
		if (mn[a][b]==0) cout << "-1\n";
		else cout << mn[a][b] << '\n';
	} else {
		if (a%2==0) {
			if (b==a+2) {
				cout << b << '\n';
				return;
			}
			if (b==1) {
				cout << a+1 << '\n';
				return;
			}
			if (b==3) {
				cout << a << '\n';
				return;
			}
		}
		if (b%2==0) {
			cout << "-1\n";
			return;
		}
		if (a<b) {

		}
		cout << "-1\n";
	}
}
int main() {
	precalc();
	for (int i=1; i<=31; i+=2) {
		for (int j=2; j<=128; j*=2) {
			cout << i << ' ' << i+j << ':' << mn[i][i+j] << '\n';
		}
		cout << '\n';
	}
	int tc;
	cin >> tc;
	while (tc--) solve();
}

Test details

Test 1

Group: 1, 2, 4

Verdict:

input
2 2
NO
1 2 

correct output
(empty)

user output
2 2
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 2

Group: 1, 2, 4

Verdict:

input
2 2
YES
1 2 
conj 2 1

correct output
(empty)

user output
2 2
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 3

Group: 1, 2, 4

Verdict:

input
10 10
NO
6 2 1 8 3 9 4 10 5 7 

correct output
(empty)

user output
10 10
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 4

Group: 1, 2, 4

Verdict:

input
10 10
YES
6 10 2 3 9 8 4 5 7 1 
disj 2 2
7 3 

correct output
(empty)

user output
10 10
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 5

Group: 1, 2, 4

Verdict:

input
10 10
YES
8 4 9 10 6 3 7 2 1 5 
disj 1 5
2 9 1 4 3 

correct output
(empty)

user output
10 10
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 6

Group: 1, 2, 4

Verdict:

input
10 10
YES
8 6 2 4 10 5 7 9 1 3 
disj 9 8
3 6 2 10 8 7 9 5 

correct output
(empty)

user output
10 10
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 7

Group: 1, 2, 4

Verdict:

input
10 10
YES
1 2 3 5 8 6 4 9 10 7 
conj 4 2
8 10 

correct output
(empty)

user output
10 10
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 8

Group: 1, 2, 4

Verdict:

input
10 10
YES
9 8 3 2 10 6 1 4 5 7 
conj 2 5
3 1 2 7 4 

correct output
(empty)

user output
10 10
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 9

Group: 1, 2, 4

Verdict:

input
10 10
YES
7 1 5 8 9 4 3 6 2 10 
conj 4 8
9 6 3 5 1 10 7 4 

correct output
(empty)

user output
10 10
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 10

Group: 2, 4

Verdict:

input
30 30
NO
17 30 6 20 28 16 7 4 14 25 18 ...

correct output
(empty)

user output
30 30
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 11

Group: 2, 4

Verdict:

input
30 30
YES
13 22 6 23 16 20 9 30 8 18 2 1...

correct output
(empty)

user output
30 30
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 12

Group: 2, 4

Verdict:

input
30 30
YES
12 30 22 9 3 7 27 21 2 28 10 1...

correct output
(empty)

user output
30 30
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 13

Group: 2, 4

Verdict:

input
30 30
YES
4 7 27 17 26 24 9 20 19 22 10 ...

correct output
(empty)

user output
30 30
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 14

Group: 2, 4

Verdict:

input
30 30
YES
7 2 24 11 4 30 17 6 9 29 5 22 ...

correct output
(empty)

user output
30 30
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 15

Group: 2, 4

Verdict:

input
30 30
YES
8 12 21 26 3 23 17 4 5 6 22 16...

correct output
(empty)

user output
30 30
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 16

Group: 2, 4

Verdict:

input
30 30
YES
8 20 19 21 24 23 25 28 5 10 13...

correct output
(empty)

user output
30 30
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 17

Group: 3

Verdict:

input
1000 999
YES
122 260 455 752 587 951 433 81...

correct output
(empty)

user output
1000 999
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 18

Group: 3

Verdict:

input
1000 999
YES
593 999 981 107 187 851 19 574...

correct output
(empty)

user output
1000 999
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 19

Group: 3

Verdict:

input
1000 999
YES
99 213 558 569 343 613 593 85 ...

correct output
(empty)

user output
1000 999
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 20

Group: 3

Verdict:

input
1000 999
YES
60 15 857 450 862 173 675 384 ...

correct output
(empty)

user output
1000 999
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 21

Group: 3

Verdict:

input
3 2
YES
3 1 
disj 1 2
2 1 

correct output
(empty)

user output
3 2
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 22

Group: 4

Verdict:

input
1000 1000
NO
493 409 829 533 156 443 530 80...

correct output
(empty)

user output
1000 1000
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 23

Group: 4

Verdict:

input
1000 1000
YES
16 450 665 56 968 1 984 545 90...

correct output
(empty)

user output
1000 1000
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 24

Group: 4

Verdict:

input
1000 1000
YES
503 289 147 513 833 468 199 82...

correct output
(empty)

user output
1000 1000
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 25

Group: 4

Verdict:

input
1000 1000
YES
294 617 164 497 46 961 234 12 ...

correct output
(empty)

user output
1000 1000
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 26

Group: 4

Verdict:

input
1000 1000
YES
465 496 15 263 713 784 337 487...

correct output
(empty)

user output
1000 1000
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 27

Group: 4

Verdict:

input
1000 1000
YES
788 567 826 731 874 95 502 20 ...

correct output
(empty)

user output
1000 1000
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0

Test 28

Group: 4

Verdict:

input
1000 1000
YES
611 543 496 586 262 765 461 83...

correct output
(empty)

user output
1000 1000
1 3:3
1 5:5
1 9:10
1 17:20
...
Truncated

Error:
1 1 0 0