# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
466050 | 2021-08-17T15:49:03 Z | gagik_2007 | Xor Sort (eJOI20_xorsort) | C++17 | 1000 ms | 17296 KB |
#include <iostream> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <set> #include <map> #include <queue> #include <deque> #include <stack> #include <iomanip> #include <unordered_set> using namespace std; #define ll long long #define ff first #define ss second ll n, m, m1, m2, k; ll MOD = 1e9 + 7; ll INF = 1e18 + 7; ll ttt; ll a[1007]; vector<pair<ll, ll>>ans; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - i - 1; j++) { if (a[j] > a[j + 1]) { ans.push_back({ j + 1,j }); ans.push_back({ j,j + 1 }); ans.push_back({ j + 1,j }); ll tmp = a[j]; a[j] = a[j + 1]; a[j + 1] = tmp; } } } cout << ans.size() << endl; for (int i = 0; i < ans.size(); i++) { cout << ans[i].ff + 1 << " " << ans[i].ss + 1 << endl; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 4 ms | 332 KB | Output is correct |
4 | Correct | 31 ms | 744 KB | Output is correct |
5 | Correct | 32 ms | 872 KB | Output is correct |
6 | Correct | 28 ms | 872 KB | Output is correct |
7 | Correct | 28 ms | 840 KB | Output is correct |
8 | Correct | 29 ms | 840 KB | Output is correct |
9 | Correct | 31 ms | 840 KB | Output is correct |
10 | Correct | 31 ms | 840 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 58 ms | 1348 KB | Output is correct |
13 | Correct | 58 ms | 1348 KB | Output is correct |
14 | Correct | 56 ms | 1348 KB | Output is correct |
15 | Correct | 56 ms | 1348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 4 ms | 332 KB | Output is correct |
4 | Correct | 31 ms | 744 KB | Output is correct |
5 | Correct | 32 ms | 872 KB | Output is correct |
6 | Correct | 28 ms | 872 KB | Output is correct |
7 | Correct | 28 ms | 840 KB | Output is correct |
8 | Correct | 29 ms | 840 KB | Output is correct |
9 | Correct | 31 ms | 840 KB | Output is correct |
10 | Correct | 31 ms | 840 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 58 ms | 1348 KB | Output is correct |
13 | Correct | 58 ms | 1348 KB | Output is correct |
14 | Correct | 56 ms | 1348 KB | Output is correct |
15 | Correct | 56 ms | 1348 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 30 ms | 840 KB | Output is correct |
18 | Correct | 51 ms | 1060 KB | Output is correct |
19 | Correct | 50 ms | 1012 KB | Output is correct |
20 | Correct | 49 ms | 1004 KB | Output is correct |
21 | Correct | 50 ms | 1020 KB | Output is correct |
22 | Correct | 52 ms | 1028 KB | Output is correct |
23 | Correct | 55 ms | 1140 KB | Output is correct |
24 | Correct | 56 ms | 1052 KB | Output is correct |
25 | Correct | 50 ms | 1008 KB | Output is correct |
26 | Incorrect | 100 ms | 1712 KB | Integer 59568 violates the range [0, 40000] |
27 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 4 ms | 332 KB | Output is correct |
4 | Correct | 62 ms | 968 KB | Output is correct |
5 | Execution timed out | 1092 ms | 17296 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |