Submission #993860

#TimeUsernameProblemLanguageResultExecution timeMemory
993860browntoadSwap (BOI16_swap)C++14
10 / 100
41 ms348 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...