답안 #671985

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
671985 2022-12-14T14:02:13 Z Lobo Swap (BOI16_swap) C++17
10 / 100
1000 ms 320 KB
#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
mt19937 rng(time(0));
const int maxn = 3e5+10;

int n;
vector<int> ans;
void sol(vector<int> v, int i) {
    if(i == n+1) {
        ans = min(ans, v);
        return;
    }
    sol(v,i+1);
    swap(v[i-1],v[i/2-1]);
    sol(v,i+1);
}

void solve() {
    cin >> n;
    vector<int> vec;
    for(int i = 1; i <= n; i++) {
        ans.pb(n);
        int x; cin >> x;
        vec.pb(x);
    }
    sol(vec,2);
    for(auto x : ans) {
         cout << x << " ";
    }cout << endl;
}

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(0);

    // freopen("in.in", "r", stdin);
    // freopen("out.out", "w", stdout);
    int tt = 1;
    // cin >> tt;
    while(tt--) {
        solve();
    }

}
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 304 KB Output is correct
2 Correct 50 ms 304 KB Output is correct
3 Correct 51 ms 320 KB Output is correct
4 Correct 41 ms 212 KB Output is correct
5 Correct 36 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 304 KB Output is correct
2 Correct 50 ms 304 KB Output is correct
3 Correct 51 ms 320 KB Output is correct
4 Correct 41 ms 212 KB Output is correct
5 Correct 36 ms 212 KB Output is correct
6 Execution timed out 1045 ms 212 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 304 KB Output is correct
2 Correct 50 ms 304 KB Output is correct
3 Correct 51 ms 320 KB Output is correct
4 Correct 41 ms 212 KB Output is correct
5 Correct 36 ms 212 KB Output is correct
6 Execution timed out 1045 ms 212 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 304 KB Output is correct
2 Correct 50 ms 304 KB Output is correct
3 Correct 51 ms 320 KB Output is correct
4 Correct 41 ms 212 KB Output is correct
5 Correct 36 ms 212 KB Output is correct
6 Execution timed out 1045 ms 212 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 304 KB Output is correct
2 Correct 50 ms 304 KB Output is correct
3 Correct 51 ms 320 KB Output is correct
4 Correct 41 ms 212 KB Output is correct
5 Correct 36 ms 212 KB Output is correct
6 Execution timed out 1045 ms 212 KB Time limit exceeded
7 Halted 0 ms 0 KB -