# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
573130 | 2022-06-06T03:55:28 Z | duypd4206 | Swap (BOI16_swap) | C++14 | 2 ms | 340 KB |
#include<bits/stdc++.h> using namespace std; #define x first #define y second #define pb push_back typedef pair<int,int> ii; using ll = long long ; const int maxn = 1e5 + 1; const int oo = 1e9 + 7; const ll ooo = 2e18 + 7; const int mod = 1e9 + 7; int a[maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); #ifndef ONLINE_JUDGE #define file "" freopen(file"inp","r",stdin); freopen(file"out","w",stdout); #endif //ONLINE_JUDGE int n; cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; for(int i = 2; i <= n; i+=2){ int k = i/2; int mn = min({a[k], a[i], a[i+1]}); if(a[k] == mn) continue; if(a[i] == mn) { swap(a[i], a[k]); continue; } if(a[i] < a[k]) swap(a[i], a[k]), swap(a[k], a[i+1]); else swap(a[k], a[i+1]); } for(int i = 1; i <= n; i++) cout << a[i] << " "; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |