Task: | Taulukot |
Sender: | |
Submission time: | 2015-10-11 19:27:27 +0300 |
Language: | C++ |
Status: | READY |
Result: | 26 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 26 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.05 s | 1 | details |
#2 | ACCEPTED | 0.05 s | 1 | details |
#3 | ACCEPTED | 0.06 s | 1 | details |
#4 | ACCEPTED | 0.06 s | 1 | details |
#5 | ACCEPTED | 0.06 s | 1 | details |
#6 | ACCEPTED | 0.06 s | 2 | details |
#7 | WRONG ANSWER | 0.05 s | 2 | details |
#8 | WRONG ANSWER | 0.05 s | 2 | details |
#9 | WRONG ANSWER | 0.05 s | 2 | details |
#10 | WRONG ANSWER | 0.06 s | 2 | details |
#11 | WRONG ANSWER | 0.07 s | 3 | details |
#12 | WRONG ANSWER | 0.07 s | 3 | details |
#13 | WRONG ANSWER | 0.09 s | 3 | details |
#14 | WRONG ANSWER | 0.09 s | 3 | details |
#15 | WRONG ANSWER | 0.21 s | 3 | details |
Code
#include <bits/stdc++.h> #define i64 long long #define u64 unsigned long long #define i32 int #define u32 unsigned int #define pii pair<int, int> #define pll pair<long long, long long> #define defmod 1000000007 using namespace std; bool sieve[1010101] = {0}; void eratosthenes(int n) { sieve[0] = 1; sieve[1] = 1; int m = (int) sqrt((double) n); for(int i = 0; i <= m; i++) { if(!sieve[i]) { for (int j = i*i; j <= n; j += i) sieve[j] = 1; } } } int main(){ cin.sync_with_stdio(0); cin.tie(0); eratosthenes(200010); int n; cin >> n; unordered_set<int> a; unordered_set<int> b; for(int i = 0; i < n; i++){ a.insert(i+1); b.insert(i+1); } vector<int> a1, b1; for(auto f: a){ int pp = -1; for(auto ff: b){ if(sieve[f+ff] == 0){ pp = ff; break; } } b.erase(pp); a1.push_back(f); b1.push_back(pp); } for(int i = 0; i < n; i++) cout << a1[i] << " "; cout << endl; for(int i = 0; i < n; i++) cout << b1[i] << " "; cout << endl; return 0; }
Test details
Test 1
Group: 1
Verdict: ACCEPTED
input |
---|
1 |
correct output |
---|
1 1 |
user output |
---|
1 1 |
Test 2
Group: 1
Verdict: ACCEPTED
input |
---|
4 |
correct output |
---|
1 2 3 4 2 1 4 3 |
user output |
---|
4 3 2 1 3 4 1 2 |
Test 3
Group: 1
Verdict: ACCEPTED
input |
---|
5 |
correct output |
---|
1 2 3 4 5 1 5 4 3 2 |
user output |
---|
5 4 3 2 1 2 3 4 5 1 |
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 |
---|
8 7 6 5 4 3 2 1 5 6 7 8 3 4 1 2 |
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 |
---|
9 8 7 6 5 4 3 2 1 8 9 6 7 2 3 4 5 1 |
Test 6
Group: 2
Verdict: ACCEPTED
input |
---|
77 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
77 76 75 74 73 72 71 70 69 68 ... |
Test 7
Group: 2
Verdict: WRONG ANSWER
input |
---|
70 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
70 69 68 67 66 65 64 63 62 61 ... |
Test 8
Group: 2
Verdict: WRONG ANSWER
input |
---|
72 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
72 71 70 69 68 67 66 65 64 63 ... |
Test 9
Group: 2
Verdict: WRONG ANSWER
input |
---|
86 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
86 85 84 83 82 81 80 79 78 77 ... |
Test 10
Group: 2
Verdict: WRONG ANSWER
input |
---|
68 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
68 67 66 65 64 63 62 61 60 59 ... |
Test 11
Group: 3
Verdict: WRONG ANSWER
input |
---|
90764 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
90764 90763 90762 90761 90760 ... |
Test 12
Group: 3
Verdict: WRONG ANSWER
input |
---|
97976 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
97976 97975 97974 97973 97972 ... |
Test 13
Group: 3
Verdict: WRONG ANSWER
input |
---|
96762 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
96762 96761 96760 96759 96758 ... |
Test 14
Group: 3
Verdict: WRONG ANSWER
input |
---|
94823 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
94823 94822 94821 94820 94819 ... |
Test 15
Group: 3
Verdict: WRONG ANSWER
input |
---|
91479 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
91479 91478 91477 91476 91475 ... |