# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
974015 | 2024-05-02T15:13:25 Z | canadavid1 | Swap (BOI16_swap) | C++17 | 0 ms | 348 KB |
#include <iostream> #include <vector> #include <set> #include <algorithm> int main() { std::cin.tie(0)->sync_with_stdio(false); int N; std::cin >> N; std::vector<int> v(N); for(auto& i : v) std::cin >> i; v.insert(v.begin(),0); std::vector<int> out(N+1,0); std::vector<int> ls = v; // for(auto& i : ls) std::cerr << i; // std::cerr << "\n"; for(int B = 0; B < 1<<((N+1)/2); B++) { std::vector<int> curr = v; for(int i = 1; i < (N+1)/2; i++) { if ((B>>i)&1) std::swap(curr[i],curr[i*2]); if (curr[i*2+1] < curr[i]) std::swap(curr[i],curr[i*2+1]); } if (N&1==0 && curr[N] > curr[N/2]) std::swap(curr[N],curr[N/2]); // for(auto& i : curr) std::cerr << i; // std::cerr << "\n"; int i = 0; for(;i <= N && ls[i]==curr[i];i++); if (curr[i] < ls[i]) ls = curr; } ls.erase(ls.begin()); for(auto i : ls) std::cout << i << " "; std::cout << "\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |