Submission #829307

#TimeUsernameProblemLanguageResultExecution timeMemory
829307ayankarimovaXor Sort (eJOI20_xorsort)C++14
25 / 100
109 ms18416 KiB
#include<bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long const ll sz=100005; int main(){ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); ll n, s; cin>>n>>s; ll m[n+1]; for(int i=1; i<=n; i++){ cin>>m[i]; } vector<pair<ll, ll>>v; for(int j=1; j<n; j++){ for(int i=2; i<=n; i++){ if(m[i]<=m[i-1]){ v.push_back({i, i-1}); v.push_back({i-1, i}); v.push_back({i, i-1}); swap(m[i], m[i-1]); } } } cout<<v.size()<<endl; for(auto i:v){ cout<<i.first<<' '<<i.second<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...