108112024-04-15 13:05:37CWMSzimmetrikus sorozatcpp11Wrong answer 9/100218ms18512 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";
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1692 KiB
2Wrong answer90ms7888 KiB
subtask29/9
3Accepted3ms2072 KiB
4Accepted3ms2304 KiB
5Accepted3ms2516 KiB
6Accepted3ms2596 KiB
7Accepted3ms2728 KiB
subtask30/14
8Wrong answer3ms2904 KiB
9Accepted3ms2972 KiB
10Wrong answer3ms3096 KiB
11Accepted2ms3220 KiB
12Accepted2ms3224 KiB
13Accepted3ms3348 KiB
subtask40/25
14Wrong answer3ms3396 KiB
15Wrong answer3ms3436 KiB
16Wrong answer4ms3476 KiB
17Wrong answer4ms3512 KiB
18Wrong answer4ms3620 KiB
19Wrong answer4ms3568 KiB
20Wrong answer4ms3620 KiB
21Accepted4ms3476 KiB
subtask50/22
22Accepted134ms14936 KiB
23Accepted143ms15904 KiB
24Accepted164ms15836 KiB
25Accepted135ms14936 KiB
26Wrong answer133ms14940 KiB
27Wrong answer140ms15844 KiB
28Wrong answer150ms15844 KiB
29Wrong answer130ms15004 KiB
30Wrong answer115ms15000 KiB
31Wrong answer123ms15844 KiB
32Wrong answer127ms15840 KiB
33Wrong answer115ms14936 KiB
34Wrong answer116ms15040 KiB
35Wrong answer129ms15948 KiB
36Wrong answer131ms16212 KiB
37Wrong answer116ms15408 KiB
subtask60/30
38Accepted3ms3848 KiB
39Wrong answer90ms9660 KiB
40Accepted3ms2072 KiB
41Accepted3ms2304 KiB
42Accepted3ms2516 KiB
43Accepted3ms2596 KiB
44Accepted3ms2728 KiB
45Wrong answer3ms2904 KiB
46Accepted3ms2972 KiB
47Wrong answer3ms3096 KiB
48Accepted2ms3220 KiB
49Accepted2ms3224 KiB
50Accepted3ms3348 KiB
51Wrong answer3ms3396 KiB
52Wrong answer3ms3436 KiB
53Wrong answer4ms3476 KiB
54Wrong answer4ms3512 KiB
55Wrong answer4ms3620 KiB
56Wrong answer4ms3568 KiB
57Wrong answer4ms3620 KiB
58Accepted4ms3476 KiB
59Accepted134ms14936 KiB
60Accepted143ms15904 KiB
61Accepted164ms15836 KiB
62Accepted135ms14936 KiB
63Wrong answer133ms14940 KiB
64Wrong answer140ms15844 KiB
65Wrong answer150ms15844 KiB
66Wrong answer130ms15004 KiB
67Wrong answer115ms15000 KiB
68Wrong answer123ms15844 KiB
69Wrong answer127ms15840 KiB
70Wrong answer115ms14936 KiB
71Wrong answer116ms15040 KiB
72Wrong answer129ms15948 KiB
73Wrong answer131ms16212 KiB
74Wrong answer116ms15408 KiB
75Wrong answer193ms18512 KiB
76Wrong answer182ms11424 KiB
77Wrong answer92ms7080 KiB
78Wrong answer186ms11424 KiB
79Wrong answer166ms8576 KiB
80Accepted123ms14032 KiB
81Accepted125ms14032 KiB
82Accepted123ms14032 KiB
83Wrong answer218ms18504 KiB
84Wrong answer112ms7072 KiB
85Wrong answer187ms8752 KiB
86Accepted144ms14600 KiB
87Accepted144ms14536 KiB
88Accepted144ms14668 KiB
89Accepted146ms14660 KiB