Task: | Taulukot |
Sender: | |
Submission time: | 2015-10-09 23:22:37 +0300 |
Language: | Java |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.46 s | 1 | details |
#2 | WRONG ANSWER | 0.39 s | 1 | details |
#3 | WRONG ANSWER | 0.39 s | 1 | details |
#4 | WRONG ANSWER | 0.40 s | 1 | details |
#5 | WRONG ANSWER | 0.46 s | 1 | details |
#6 | WRONG ANSWER | 0.39 s | 2 | details |
#7 | WRONG ANSWER | 0.43 s | 2 | details |
#8 | WRONG ANSWER | 0.40 s | 2 | details |
#9 | WRONG ANSWER | 0.44 s | 2 | details |
#10 | WRONG ANSWER | 0.35 s | 2 | details |
#11 | WRONG ANSWER | 0.42 s | 3 | details |
#12 | WRONG ANSWER | 0.40 s | 3 | details |
#13 | WRONG ANSWER | 0.47 s | 3 | details |
#14 | WRONG ANSWER | 0.39 s | 3 | details |
#15 | WRONG ANSWER | 0.39 s | 3 | details |
Code
//package alkuluvut; import java.util.Arrays; import java.util.TreeSet; /** * * @author Adreno */ public class Alkuluvut { public static boolean[] eiOleAlkuLuku; public static void main(String[] args) { IO io = new IO(); //int n = io.nextInt(); int n = 100000; int max = 2*n+2; eiOleAlkuLuku = new boolean[max]; for (int i = 2; i < max; i++) { if (eiOleAlkuLuku[i]) continue; for (int j = i*i; j < max && j > 0; j += i) { eiOleAlkuLuku[j] = true; } } TreeSet<Integer> alkuluvut = new TreeSet<>(); for (int i=2; i<max; i++) { if (eiOleAlkuLuku[i]) continue; alkuluvut.add(i); } boolean[] kaytetty = new boolean[n+1]; int pointer = 0; int[] a = new int[n]; int[] b = new int[n]; for (int i=n; i>=1; i--) { if (kaytetty[i]) continue; int nextPossible = i+i+1; while (true) { nextPossible = alkuluvut.lower(nextPossible); int counterPart = nextPossible - i; if (kaytetty[counterPart]) continue; kaytetty[counterPart] = true; kaytetty[i] = true; a[pointer] = counterPart; b[pointer] = i; if (i != counterPart) { a[pointer] = i; b[pointer] = counterPart; } pointer++; break; } } for (int i=0; i<n; i++) io.print(a[i] + " "); io.println(); for (int i=0; i<n; i++) io.print(b[i] + " "); io.println(); io.close(); } }
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
1 |
correct output |
---|
1 1 |
user output |
---|
100000 99998 99997 99996 99995... |
Test 2
Group: 1
Verdict: WRONG ANSWER
input |
---|
4 |
correct output |
---|
1 2 3 4 2 1 4 3 |
user output |
---|
100000 99998 99997 99996 99995... |
Test 3
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 |
correct output |
---|
1 2 3 4 5 1 5 4 3 2 |
user output |
---|
100000 99998 99997 99996 99995... |
Test 4
Group: 1
Verdict: WRONG ANSWER
input |
---|
8 |
correct output |
---|
1 2 3 4 5 6 7 8 2 1 4 3 8 7 6 5 |
user output |
---|
100000 99998 99997 99996 99995... |
Test 5
Group: 1
Verdict: WRONG ANSWER
input |
---|
9 |
correct output |
---|
1 2 3 4 5 6 7 8 9 1 5 4 3 2 7 6 9 8 |
user output |
---|
100000 99998 99997 99996 99995... |
Test 6
Group: 2
Verdict: WRONG ANSWER
input |
---|
77 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
100000 99998 99997 99996 99995... |
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 |
---|
100000 99998 99997 99996 99995... |
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 |
---|
100000 99998 99997 99996 99995... |
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 |
---|
100000 99998 99997 99996 99995... |
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 |
---|
100000 99998 99997 99996 99995... |
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 |
---|
100000 99998 99997 99996 99995... |
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 |
---|
100000 99998 99997 99996 99995... |
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 |
---|
100000 99998 99997 99996 99995... |
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 |
---|
100000 99998 99997 99996 99995... |
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 |
---|
100000 99998 99997 99996 99995... |