답안 #993860

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
993860 2024-06-06T15:21:23 Z browntoad Swap (BOI16_swap) C++14
10 / 100
41 ms 348 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
#define ll long long
#define int ll
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define pii pair<int, int>
#define f first
#define s second
#define SZ(x) (int)((x).size())
#define ALL(x) (x).begin(), (x).end()
#define pb push_back
#define IOS() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

const ll maxn = 2e5+5;
const ll inf = 1ll<<60;

signed main(){
    int n; cin>>n;
    vector<int> vc(n+1);
    REP1(i, n) cin>>vc[i];

    vector<int> tmp;
    int tmd = (1<<(n-1));
    vector<int> ans = vc;
    REP(i, tmd){
        tmp = vc;
        FOR(j, 2, n+1){
            if ((1<<(j-2))&i){
                swap(tmp[j], tmp[j/2]);
            }
        }
        ans = min(ans, tmp);
    }
    REP1(i, n) cout<<ans[i]<<' ';
    cout<<endl;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 348 KB Output is correct
2 Correct 37 ms 348 KB Output is correct
3 Correct 41 ms 348 KB Output is correct
4 Correct 41 ms 348 KB Output is correct
5 Correct 37 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 348 KB Output is correct
2 Correct 37 ms 348 KB Output is correct
3 Correct 41 ms 348 KB Output is correct
4 Correct 41 ms 348 KB Output is correct
5 Correct 37 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 348 KB Output is correct
2 Correct 37 ms 348 KB Output is correct
3 Correct 41 ms 348 KB Output is correct
4 Correct 41 ms 348 KB Output is correct
5 Correct 37 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 348 KB Output is correct
2 Correct 37 ms 348 KB Output is correct
3 Correct 41 ms 348 KB Output is correct
4 Correct 41 ms 348 KB Output is correct
5 Correct 37 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 348 KB Output is correct
2 Correct 37 ms 348 KB Output is correct
3 Correct 41 ms 348 KB Output is correct
4 Correct 41 ms 348 KB Output is correct
5 Correct 37 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -