(I3
I114
I8
(dp0
Vswap.%l
p1
(Vswap.cpp
p2
S'#include <iostream>\r\n#include <vector>\r\n#include <queue>\r\n#include <algorithm>\r\n\r\nusing namespace std;\r\n\r\nint main ()\r\n{\r\n    cin.tie (nullptr);\r\n    ios::sync_with_stdio (false);\r\n    int N;\r\n    cin >> N;\r\n    vector <int> P;\r\n    vector <int> origP;\r\n    for (int i = 0 ; i < N ; i ++)\r\n    {\r\n        int a;\r\n        cin >> a;\r\n        P.push_back (a);\r\n    }\r\n    origP = P;\r\n    sort (origP.begin (), origP.end ());\r\n\r\n    queue < pair < vector < int >, vector < pair < int, int > > > > q;\r\n    q.push ({P, {}});\r\n    while (!q.empty ())\r\n    {\r\n        auto front = q.front (); q.pop ();\r\n        auto currP = front.first;\r\n        auto path = front.second;\r\n\r\n        if (currP == origP)\r\n        {\r\n            cout << path.size () << "\\n";\r\n            for (auto& x : path)\r\n                cout << x.first + 1 << " " << x.second + 1 << "\\n";\r\n            return 0;\r\n        }\r\n\r\n        for (int i = 0 ; i < currP.size () - 1 ; i ++)\r\n        {\r\n            if (currP [i] != i + 1 and currP [i + 1] != i + 2)\r\n            {\r\n                swap (currP [i], currP [i + 1]);\r\n                path.push_back ({i, i + 1});\r\n                q.push ({currP, path});\r\n                path.pop_back ();\r\n                swap (currP [i], currP [i + 1]);\r\n            }\r\n        }\r\n    }\r\n}\r\n'
p3
tp4
stp5
.