Submission #707927

# Submission time Handle Problem Language Result Execution time Memory
707927 2023-03-10T14:00:54 Z josanneo22 Xor Sort (eJOI20_xorsort) C++17
25 / 100
13 ms 1236 KB
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, s; cin >> n >> s;
	vector<int> a(n);
	for (auto& x : a) cin >> x;
	vector<pair<int, int>> ans;
	if (s == 1) {
		for (int j = 1; j < n; j++) {
			for (int i = 1; i < n; i++) {
				if (a[i] < a[i - 1]) {
					ans.push_back(make_pair(i, i - 1));
					ans.push_back(make_pair(i - 1, i));
					ans.push_back(make_pair(i, i - 1));
					swap(a[i], a[i - 1]);
				}
			}
		}
	}
	cout << ans.size() << '\n';
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i].first+1 << ' ' << ans[i].second+1 << '\n';
	}
}

Compilation message

xorsort.cpp: In function 'int main()':
xorsort.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for (int i = 0; i < ans.size(); i++) {
      |                  ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 3 ms 576 KB Output is correct
5 Correct 3 ms 708 KB Output is correct
6 Correct 3 ms 600 KB Output is correct
7 Correct 3 ms 700 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 4 ms 600 KB Output is correct
10 Correct 3 ms 600 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 5 ms 984 KB Output is correct
13 Correct 5 ms 856 KB Output is correct
14 Correct 5 ms 856 KB Output is correct
15 Correct 6 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 3 ms 576 KB Output is correct
5 Correct 3 ms 708 KB Output is correct
6 Correct 3 ms 600 KB Output is correct
7 Correct 3 ms 700 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 4 ms 600 KB Output is correct
10 Correct 3 ms 600 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 5 ms 984 KB Output is correct
13 Correct 5 ms 856 KB Output is correct
14 Correct 5 ms 856 KB Output is correct
15 Correct 6 ms 856 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 4 ms 724 KB Output is correct
18 Correct 5 ms 856 KB Output is correct
19 Correct 6 ms 836 KB Output is correct
20 Correct 5 ms 872 KB Output is correct
21 Correct 5 ms 832 KB Output is correct
22 Correct 6 ms 856 KB Output is correct
23 Correct 5 ms 856 KB Output is correct
24 Correct 5 ms 856 KB Output is correct
25 Correct 6 ms 856 KB Output is correct
26 Incorrect 13 ms 1236 KB Integer 59568 violates the range [0, 40000]
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Not sorted
2 Halted 0 ms 0 KB -