Submission #707925

# Submission time Handle Problem Language Result Execution time Memory
707925 2023-03-10T13:56:12 Z josanneo22 Xor Sort (eJOI20_xorsort) C++17
0 / 100
0 ms 212 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 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]);
			}
		}
	}
	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:20: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]
   20 |  for (int i = 0; i < ans.size(); i++) {
      |                  ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Not adjacent
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Not adjacent
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -