# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
258483 | 2020-08-06T04:24:34 Z | 반딧불(#5073) | Swap (BOI16_swap) | C++17 | 0 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; int arr[200002]; int main(){ scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%d", &arr[i]); for(int i=2; i<=n; i+=2){ if(i==n){ if(arr[i/2] > arr[i]) swap(arr[i/2], arr[i]); } else{ int tmin = min({arr[i/2], arr[i], arr[i+1]}); if(tmin == arr[i/2]) continue; else if(tmin == arr[i]) swap(arr[i/2], arr[i]); else{ if(arr[i] > arr[i/2]) swap(arr[i/2], arr[i]); swap(arr[i/2], arr[i+1]); } } } for(int i=1; i<=n; i++) printf("%d ", arr[i]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |