10811 | 2024-04-15 13:05:37 | CWM | Szimmetrikus sorozat | cpp11 | Wrong answer 9/100 | 218ms | 18512 KiB |
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
map<int, int> change;
vector<int> inp(n);
vector<pair<int, int>> updates;
for (size_t i = 0; i < n; i++)
{
cin >> inp[i];
}
for (size_t i = 0; i < n/2; i++)
{
int one = inp[i];
int two = inp[n - i - 1];
if (change[one] != 0) {
one = change[one];
}
if (change[two] != 0) {
two = change[two];
}
if (one == two) continue;
else {
int mx = max(one, two);
int mn = min(one, two);
updates.push_back({ mx, mn });
change[mx] = mn;
}
}
cout << updates.size() << "\n";
for (size_t i = 0; i < updates.size(); i++)
{
cout << updates[i].first << " " << updates[i].second << "\n";
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1692 KiB | ||||
2 | Wrong answer | 90ms | 7888 KiB | ||||
subtask2 | 9/9 | ||||||
3 | Accepted | 3ms | 2072 KiB | ||||
4 | Accepted | 3ms | 2304 KiB | ||||
5 | Accepted | 3ms | 2516 KiB | ||||
6 | Accepted | 3ms | 2596 KiB | ||||
7 | Accepted | 3ms | 2728 KiB | ||||
subtask3 | 0/14 | ||||||
8 | Wrong answer | 3ms | 2904 KiB | ||||
9 | Accepted | 3ms | 2972 KiB | ||||
10 | Wrong answer | 3ms | 3096 KiB | ||||
11 | Accepted | 2ms | 3220 KiB | ||||
12 | Accepted | 2ms | 3224 KiB | ||||
13 | Accepted | 3ms | 3348 KiB | ||||
subtask4 | 0/25 | ||||||
14 | Wrong answer | 3ms | 3396 KiB | ||||
15 | Wrong answer | 3ms | 3436 KiB | ||||
16 | Wrong answer | 4ms | 3476 KiB | ||||
17 | Wrong answer | 4ms | 3512 KiB | ||||
18 | Wrong answer | 4ms | 3620 KiB | ||||
19 | Wrong answer | 4ms | 3568 KiB | ||||
20 | Wrong answer | 4ms | 3620 KiB | ||||
21 | Accepted | 4ms | 3476 KiB | ||||
subtask5 | 0/22 | ||||||
22 | Accepted | 134ms | 14936 KiB | ||||
23 | Accepted | 143ms | 15904 KiB | ||||
24 | Accepted | 164ms | 15836 KiB | ||||
25 | Accepted | 135ms | 14936 KiB | ||||
26 | Wrong answer | 133ms | 14940 KiB | ||||
27 | Wrong answer | 140ms | 15844 KiB | ||||
28 | Wrong answer | 150ms | 15844 KiB | ||||
29 | Wrong answer | 130ms | 15004 KiB | ||||
30 | Wrong answer | 115ms | 15000 KiB | ||||
31 | Wrong answer | 123ms | 15844 KiB | ||||
32 | Wrong answer | 127ms | 15840 KiB | ||||
33 | Wrong answer | 115ms | 14936 KiB | ||||
34 | Wrong answer | 116ms | 15040 KiB | ||||
35 | Wrong answer | 129ms | 15948 KiB | ||||
36 | Wrong answer | 131ms | 16212 KiB | ||||
37 | Wrong answer | 116ms | 15408 KiB | ||||
subtask6 | 0/30 | ||||||
38 | Accepted | 3ms | 3848 KiB | ||||
39 | Wrong answer | 90ms | 9660 KiB | ||||
40 | Accepted | 3ms | 2072 KiB | ||||
41 | Accepted | 3ms | 2304 KiB | ||||
42 | Accepted | 3ms | 2516 KiB | ||||
43 | Accepted | 3ms | 2596 KiB | ||||
44 | Accepted | 3ms | 2728 KiB | ||||
45 | Wrong answer | 3ms | 2904 KiB | ||||
46 | Accepted | 3ms | 2972 KiB | ||||
47 | Wrong answer | 3ms | 3096 KiB | ||||
48 | Accepted | 2ms | 3220 KiB | ||||
49 | Accepted | 2ms | 3224 KiB | ||||
50 | Accepted | 3ms | 3348 KiB | ||||
51 | Wrong answer | 3ms | 3396 KiB | ||||
52 | Wrong answer | 3ms | 3436 KiB | ||||
53 | Wrong answer | 4ms | 3476 KiB | ||||
54 | Wrong answer | 4ms | 3512 KiB | ||||
55 | Wrong answer | 4ms | 3620 KiB | ||||
56 | Wrong answer | 4ms | 3568 KiB | ||||
57 | Wrong answer | 4ms | 3620 KiB | ||||
58 | Accepted | 4ms | 3476 KiB | ||||
59 | Accepted | 134ms | 14936 KiB | ||||
60 | Accepted | 143ms | 15904 KiB | ||||
61 | Accepted | 164ms | 15836 KiB | ||||
62 | Accepted | 135ms | 14936 KiB | ||||
63 | Wrong answer | 133ms | 14940 KiB | ||||
64 | Wrong answer | 140ms | 15844 KiB | ||||
65 | Wrong answer | 150ms | 15844 KiB | ||||
66 | Wrong answer | 130ms | 15004 KiB | ||||
67 | Wrong answer | 115ms | 15000 KiB | ||||
68 | Wrong answer | 123ms | 15844 KiB | ||||
69 | Wrong answer | 127ms | 15840 KiB | ||||
70 | Wrong answer | 115ms | 14936 KiB | ||||
71 | Wrong answer | 116ms | 15040 KiB | ||||
72 | Wrong answer | 129ms | 15948 KiB | ||||
73 | Wrong answer | 131ms | 16212 KiB | ||||
74 | Wrong answer | 116ms | 15408 KiB | ||||
75 | Wrong answer | 193ms | 18512 KiB | ||||
76 | Wrong answer | 182ms | 11424 KiB | ||||
77 | Wrong answer | 92ms | 7080 KiB | ||||
78 | Wrong answer | 186ms | 11424 KiB | ||||
79 | Wrong answer | 166ms | 8576 KiB | ||||
80 | Accepted | 123ms | 14032 KiB | ||||
81 | Accepted | 125ms | 14032 KiB | ||||
82 | Accepted | 123ms | 14032 KiB | ||||
83 | Wrong answer | 218ms | 18504 KiB | ||||
84 | Wrong answer | 112ms | 7072 KiB | ||||
85 | Wrong answer | 187ms | 8752 KiB | ||||
86 | Accepted | 144ms | 14600 KiB | ||||
87 | Accepted | 144ms | 14536 KiB | ||||
88 | Accepted | 144ms | 14668 KiB | ||||
89 | Accepted | 146ms | 14660 KiB |