제출 #465731

#제출 시각아이디문제언어결과실행 시간메모리
465731idasXor Sort (eJOI20_xorsort)C++11
0 / 100
1 ms204 KiB
#include<bits/stdc++.h> #define FOR(i, begin, end) for(int i=(begin); i<(end); i++) #define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr) #define PB push_back #define F first #define S second const int INF=1e9; const long long LINF=1e18; using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; typedef map<int, int> mii; const int N=210; int n, a[N], s; vector<pii> ans; int main() { FAST_IO; cin >> n >> s; FOR(i, 0, n) cin >> a[i]; bool going=true; while(going){ going=false; FOR(i, 1, n) { if(a[i-1]>a[i]){ swap(a[i-1], a[i]); ans.PB({i, i+1}); ans.PB({i+1, i}); ans.PB({i, i+1}); going=true; } } } /*cout << ans.size() << '\n'; for(auto[x, y] : ans){ cout << x << " " << y << '\n'; }*/ FOR(i, 0, n) cout << a[i] << " "; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...