# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
466009 |
2021-08-17T14:04:59 Z |
fuad27 |
Xor Sort (eJOI20_xorsort) |
C++17 |
|
1000 ms |
11440 KB |
#include<bits/stdc++.h>
using namespace std;
vector<pair<int, int>> v;
void sw(int i, int j) {
v.push_back({j, i});
v.push_back({i, j});
v.push_back({j, i});
}
int main () {
int n, s;
cin >> n >> s;
int a[n];
for(int i = 0;i<n;i++) {
cin >> a[i];
}
for(int i = 1;i<=n;i++) {
bool check = false;
for(int j = 0;j<n-i;j++) {
if(a[j] > a[j+1]) {
sw(j+1, j+2);
swap(a[j], a[j+1]);
check = true;
}
}
if(!check)break;
}
cout<<v.size()<<endl;
for(auto [i, j]:v) {
cout<<i<<' '<<j<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
4 ms |
324 KB |
Output is correct |
4 |
Correct |
26 ms |
588 KB |
Output is correct |
5 |
Correct |
30 ms |
680 KB |
Output is correct |
6 |
Correct |
28 ms |
612 KB |
Output is correct |
7 |
Correct |
30 ms |
616 KB |
Output is correct |
8 |
Correct |
28 ms |
636 KB |
Output is correct |
9 |
Correct |
36 ms |
656 KB |
Output is correct |
10 |
Correct |
30 ms |
600 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
59 ms |
840 KB |
Output is correct |
13 |
Correct |
59 ms |
880 KB |
Output is correct |
14 |
Correct |
57 ms |
840 KB |
Output is correct |
15 |
Correct |
57 ms |
876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
4 ms |
324 KB |
Output is correct |
4 |
Correct |
26 ms |
588 KB |
Output is correct |
5 |
Correct |
30 ms |
680 KB |
Output is correct |
6 |
Correct |
28 ms |
612 KB |
Output is correct |
7 |
Correct |
30 ms |
616 KB |
Output is correct |
8 |
Correct |
28 ms |
636 KB |
Output is correct |
9 |
Correct |
36 ms |
656 KB |
Output is correct |
10 |
Correct |
30 ms |
600 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
59 ms |
840 KB |
Output is correct |
13 |
Correct |
59 ms |
880 KB |
Output is correct |
14 |
Correct |
57 ms |
840 KB |
Output is correct |
15 |
Correct |
57 ms |
876 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
30 ms |
648 KB |
Output is correct |
18 |
Correct |
52 ms |
832 KB |
Output is correct |
19 |
Correct |
51 ms |
848 KB |
Output is correct |
20 |
Correct |
51 ms |
732 KB |
Output is correct |
21 |
Correct |
54 ms |
840 KB |
Output is correct |
22 |
Correct |
62 ms |
756 KB |
Output is correct |
23 |
Correct |
54 ms |
840 KB |
Output is correct |
24 |
Correct |
52 ms |
728 KB |
Output is correct |
25 |
Correct |
50 ms |
840 KB |
Output is correct |
26 |
Incorrect |
99 ms |
1244 KB |
Integer 59568 violates the range [0, 40000] |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
4 ms |
204 KB |
Output is correct |
4 |
Correct |
52 ms |
832 KB |
Output is correct |
5 |
Execution timed out |
1087 ms |
11440 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |