CSES - Putka Open 2015 – 4/6 - Results
Submission details
Task:Taulukot
Sender:
Submission time:2015-10-11 18:46:57 +0300
Language:C++
Status:READY
Result:26
Feedback
groupverdictscore
#1ACCEPTED26
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.05 s1details
#2ACCEPTED0.06 s1details
#3ACCEPTED0.06 s1details
#4ACCEPTED0.06 s1details
#5ACCEPTED0.06 s1details
#6--2details
#7--2details
#8--2details
#9--2details
#10--2details
#110.14 s3details
#120.12 s3details
#130.14 s3details
#140.14 s3details
#150.15 s3details

Code

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int n; cin >> n;
	int a[n];
	int b[n];
	int p[2*n+1];
	for (int i = 0; i < n; i++) {
		a[i] = i+1; b[i] = i+1;
	}
	for (int i = 0; i <= 2*n; i++) {
		p[i] = 0;
	}
	for (int i = 2; i <= 2*n; i++) {
		if (p[i]) continue;
		for (int j = i*i; j <= 2*n; j += i) {
			p[j] = 1;
		}
	}
	while (true) {
		random_shuffle(b,b+n);
		bool flag = true;
		for (int i = 0; i < n; i++) {
			if (p[a[i]+b[i]]) {
				flag = false;
				break;
			}
		}
		if (flag) break;
	}
	for (int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}
	cout << "\n";
	for (int i = 0; i < n; i++) {
		cout << b[i] << " ";
	}
	cout << "\n";
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
1

correct output


user output


Test 2

Group: 1

Verdict: ACCEPTED

input
4

correct output
1 2 3 4 
2 1 4 3 

user output
1 2 3 4 
2 3 4 1 

Test 3

Group: 1

Verdict: ACCEPTED

input
5

correct output
1 2 3 4 5 
1 5 4 3 2 

user output
1 2 3 4 5 
1 5 4 3 2 

Test 4

Group: 1

Verdict: ACCEPTED

input
8

correct output
1 2 3 4 5 6 7 8 
2 1 4 3 8 7 6 5 

user output
1 2 3 4 5 6 7 8 
2 3 8 7 6 1 4 5 

Test 5

Group: 1

Verdict: ACCEPTED

input
9

correct output
1 2 3 4 5 6 7 8 9 
1 5 4 3 2 7 6 9 8 

user output
1 2 3 4 5 6 7 8 9 
1 3 4 7 2 5 6 9 8 

Test 6

Group: 2

Verdict:

input
77

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 7

Group: 2

Verdict:

input
70

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 8

Group: 2

Verdict:

input
72

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 9

Group: 2

Verdict:

input
86

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 10

Group: 2

Verdict:

input
68

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 11

Group: 3

Verdict:

input
90764

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 12

Group: 3

Verdict:

input
97976

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 13

Group: 3

Verdict:

input
96762

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 14

Group: 3

Verdict:

input
94823

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 15

Group: 3

Verdict:

input
91479

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)