| Task: | Pair sort |
| Sender: | aalto26dw_005 |
| Submission time: | 2026-09-23 16:51:38 +0300 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | details |
| #2 | WRONG ANSWER | 0.00 s | details |
| #3 | WRONG ANSWER | 0.00 s | details |
| #4 | WRONG ANSWER | 0.00 s | details |
| #5 | WRONG ANSWER | 0.00 s | details |
| #6 | WRONG ANSWER | 0.00 s | details |
| #7 | WRONG ANSWER | 0.00 s | details |
| #8 | WRONG ANSWER | 0.00 s | details |
| #9 | WRONG ANSWER | 0.01 s | details |
| #10 | WRONG ANSWER | 0.01 s | details |
| #11 | WRONG ANSWER | 0.01 s | details |
| #12 | WRONG ANSWER | 0.01 s | details |
| #13 | WRONG ANSWER | 0.01 s | details |
| #14 | WRONG ANSWER | 0.01 s | details |
Code
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdint>
#include <limits>
#include <utility>
int main() {
int64_t n;
std::cin >> n;
std::vector<int64_t> array(2*n);
for (auto &element : array) {
std::cin >> element;
}
std::vector<int64_t> indicies(n+1, -1);
for (int64_t i = 0; i < 2*n; ++i) {
int64_t element = array[i];
if (indicies[element] == -1) {
indicies[element] = i;
} else {
int64_t new_position = indicies[element];
if (new_position%2 == 1) new_position--;
else new_position++;
if (new_position == i) continue;
int64_t old_element = array[new_position];
indicies[old_element] = i;
std::swap(array[i], array[new_position]);
std::cout << new_position+1 << " " << i+1 << std::endl;
}
}
}Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 5 3 2 4 5 1 3 2 1 4 5 |
| correct output |
|---|
| 3 2 6 4 9 6 8 |
| user output |
|---|
| 2 6 5 7 4 9 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 5 3 2 4 5 1 3 2 1 4 5 |
| correct output |
|---|
| 3 2 6 4 9 6 8 |
| user output |
|---|
| 2 6 5 7 4 9 |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 10 3 6 6 8 8 9 9 1 4 5 2 4 10 2 1... |
| correct output |
|---|
| 9 2 17 4 17 6 17 8 17 ... |
| user output |
|---|
| 1 3 3 5 5 7 10 12 12 14 ... |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 10 3 6 6 8 8 9 9 1 4 5 2 4 10 2 1... |
| correct output |
|---|
| 9 2 17 4 17 6 17 8 17 ... |
| user output |
|---|
| 1 3 3 5 5 7 10 12 12 14 ... |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 50 47 26 6 35 13 18 9 19 14 50 34... |
| correct output |
|---|
| 48 2 87 4 78 6 71 8 55 ... |
| user output |
|---|
| 15 23 10 27 27 29 18 30 23 33 ... |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 50 47 26 6 35 13 18 9 19 14 50 34... |
| correct output |
|---|
| 48 2 87 4 78 6 71 8 55 ... |
| user output |
|---|
| 15 23 10 27 27 29 18 30 23 33 ... |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 100 56 26 6 35 60 72 9 55 83 51 58... |
| correct output |
|---|
| 97 2 77 4 108 6 141 8 55 ... |
| user output |
|---|
| 7 13 5 21 15 23 18 30 3 34 ... |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 100 56 26 6 35 60 72 9 55 83 51 58... |
| correct output |
|---|
| 97 2 77 4 108 6 141 8 55 ... |
| user output |
|---|
| 7 13 5 21 15 23 18 30 3 34 ... |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 500 56 146 351 35 281 235 354 449 ... |
| correct output |
|---|
| 497 2 758 4 820 6 125 8 243 ... |
| user output |
|---|
| 10 52 34 77 44 81 29 93 38 109 ... |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 500 56 146 351 35 281 235 354 449 ... |
| correct output |
|---|
| 497 2 758 4 820 6 125 8 243 ... |
| user output |
|---|
| 10 52 34 77 44 81 29 93 38 109 ... |
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| 1000 603 596 351 885 530 235 354 56... |
| correct output |
|---|
| 993 2 256 4 1534 6 816 8 1057 ... |
| user output |
|---|
| 9 18 43 49 37 51 34 77 77 84 ... |
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| 1000 603 596 351 885 530 235 354 56... |
| correct output |
|---|
| 993 2 256 4 1534 6 816 8 1057 ... |
| user output |
|---|
| 9 18 43 49 37 51 34 77 77 84 ... |
Test 13
Verdict: WRONG ANSWER
| input |
|---|
| 5000 1594 596 1797 3776 1201 235 35... |
| correct output |
|---|
| 4993 2 1548 4 9062 6 6397 8 8296 ... |
| user output |
|---|
| 42 116 164 175 112 350 330 384 289 420 ... |
Test 14
Verdict: WRONG ANSWER
| input |
|---|
| 5000 1594 596 1797 3776 1201 235 35... |
| correct output |
|---|
| 4993 2 1548 4 9062 6 6397 8 8296 ... |
| user output |
|---|
| 42 116 164 175 112 350 330 384 289 420 ... |
