# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
974020 | 2024-05-02T15:19:15 Z | canadavid1 | Swap (BOI16_swap) | C++17 | 25 ms | 344 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)/2); B++) { std::vector<int> curr = v; for(int i = 2; i <=N; i++) { bool s; if (i&1 == 1) s = curr[i/2] > curr[i]; else s = (B>>(i/2))&1; if (s) std::swap(curr[i/2],curr[i]); } //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 | 25 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |