# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
56206 |
2018-07-10T08:57:34 Z |
노영훈(#1580) |
Swap (BOI16_swap) |
C++11 |
|
2 ms |
376 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=500010, inf=2e9;
int n;
int A[MX], B[MX];
bool done[MX];
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n;
for(int i=1; i<=n; i++) cin>>A[i];
for(int i=1; i<=n; i++){
int mn=inf;
for(int j=1; j<=i; j++)
if(!done[A[j]]) mn=min(mn, A[j]);
if(i*2<=n) mn=min(n, A[i*2]);
if(i*2+1<=n) mn=min(n, A[i*2+1]);
B[i]=mn; done[mn]=true;
}
for(int i=1; i<=n; i++) cout<<B[i]<<' ';
cout<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |