Submission #632973

# Submission time Handle Problem Language Result Execution time Memory
632973 2022-08-21T10:30:48 Z gagik_2007 Xor Sort (eJOI20_xorsort) C++17
25 / 100
1000 ms 12628 KB
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <limits>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <random>
using namespace std;

typedef long long ll;
typedef double ld;
typedef ll itn;

#define ff first
#define ss second

ll ttt;
const ll INF = 1e18;
const ll SAFEINF = 1e12;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 32768;
const ll N = 100007;
ll n, m, k;
ll a[1007];
vector<pair<int, int>>d;

void poxi(int i, int j) {
	d.push_back({ i,j });
	d.push_back({ j,i });
	d.push_back({ i,j });
	swap(a[i], a[j]);
}

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j < i; j++) {
			if (a[j] > a[j + 1])poxi(j, j + 1);
		}
	}
	cout << d.size() << endl;
	for (auto x : d) {
		cout << x.ff + 1 << " " << x.ss + 1 << endl;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 19 ms 592 KB Output is correct
5 Correct 23 ms 688 KB Output is correct
6 Correct 26 ms 656 KB Output is correct
7 Correct 21 ms 672 KB Output is correct
8 Correct 24 ms 688 KB Output is correct
9 Correct 23 ms 684 KB Output is correct
10 Correct 23 ms 596 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 46 ms 864 KB Output is correct
13 Correct 51 ms 884 KB Output is correct
14 Correct 44 ms 848 KB Output is correct
15 Correct 41 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 19 ms 592 KB Output is correct
5 Correct 23 ms 688 KB Output is correct
6 Correct 26 ms 656 KB Output is correct
7 Correct 21 ms 672 KB Output is correct
8 Correct 24 ms 688 KB Output is correct
9 Correct 23 ms 684 KB Output is correct
10 Correct 23 ms 596 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 46 ms 864 KB Output is correct
13 Correct 51 ms 884 KB Output is correct
14 Correct 44 ms 848 KB Output is correct
15 Correct 41 ms 848 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 24 ms 720 KB Output is correct
18 Correct 39 ms 836 KB Output is correct
19 Correct 39 ms 836 KB Output is correct
20 Correct 36 ms 816 KB Output is correct
21 Correct 50 ms 764 KB Output is correct
22 Correct 40 ms 776 KB Output is correct
23 Correct 39 ms 852 KB Output is correct
24 Correct 37 ms 816 KB Output is correct
25 Correct 47 ms 744 KB Output is correct
26 Incorrect 90 ms 1192 KB Integer 59568 violates the range [0, 40000]
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 38 ms 748 KB Output is correct
5 Execution timed out 1014 ms 12628 KB Time limit exceeded
6 Halted 0 ms 0 KB -