# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
974018 |
2024-05-02T15:16:38 Z |
canadavid1 |
Swap (BOI16_swap) |
C++17 |
|
101 ms |
432 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; B++)
{
std::vector<int> curr = v;
for(int i = 1; i <=N; i++)
{
if ((B>>(i-1))&1) 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";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
424 KB |
Output is correct |
2 |
Correct |
91 ms |
348 KB |
Output is correct |
3 |
Correct |
101 ms |
432 KB |
Output is correct |
4 |
Correct |
94 ms |
432 KB |
Output is correct |
5 |
Correct |
96 ms |
432 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
424 KB |
Output is correct |
2 |
Correct |
91 ms |
348 KB |
Output is correct |
3 |
Correct |
101 ms |
432 KB |
Output is correct |
4 |
Correct |
94 ms |
432 KB |
Output is correct |
5 |
Correct |
96 ms |
432 KB |
Output is correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
424 KB |
Output is correct |
2 |
Correct |
91 ms |
348 KB |
Output is correct |
3 |
Correct |
101 ms |
432 KB |
Output is correct |
4 |
Correct |
94 ms |
432 KB |
Output is correct |
5 |
Correct |
96 ms |
432 KB |
Output is correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
424 KB |
Output is correct |
2 |
Correct |
91 ms |
348 KB |
Output is correct |
3 |
Correct |
101 ms |
432 KB |
Output is correct |
4 |
Correct |
94 ms |
432 KB |
Output is correct |
5 |
Correct |
96 ms |
432 KB |
Output is correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
424 KB |
Output is correct |
2 |
Correct |
91 ms |
348 KB |
Output is correct |
3 |
Correct |
101 ms |
432 KB |
Output is correct |
4 |
Correct |
94 ms |
432 KB |
Output is correct |
5 |
Correct |
96 ms |
432 KB |
Output is correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |