Submission #1070282

# Submission time Handle Problem Language Result Execution time Memory
1070282 2024-08-22T12:45:14 Z AdamGS Xor Sort (eJOI20_xorsort) C++17
0 / 100
1 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e3+7;
int T[LIM], n;
vector<pair<int,int>>V;
void solve1() {
	rep(i, n-1) V.pb({i+1, i});
	rep(i, n) for(int j=i; j>0; --j) if(T[j-1]>T[j]) {
		V.pb({j-1, j});
		if(j-1>0) V.pb({j-1, j-2});
	}
	for(int i=n-2; i>=0; --i) V.pb({i+1, i});
}
void solve2() {

}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int s;
	cin >> n >> s;
	rep(i, n) cin >> T[i];
	if(s==1) solve1();
	else solve2();
	cout << V.size() << '\n';
	for(auto i : V) cout << i.st+1 << " " << i.nd+1 << '\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Not sorted
2 Halted 0 ms 0 KB -