# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
887342 |
2023-12-14T09:36:36 Z |
vjudge1 |
Swap (BOI16_swap) |
C++17 |
|
94 ms |
500 KB |
// in the name of God
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fast() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ff first
#define ss second
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define mk make_pair
#define ppb pop_back
#define endl '\n'
#define pii pair<int, int>
#define sz(x) (int)x.size()
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O4")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2")
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mod = 1e9 + 7, maxn = 1e5 + 10, inf = 1e9 + 1, lg = 25, pp = 4447, modd = 1e9 + 9;
signed main(){
fast();
int n; cin >> n;
vector<int> a, b;
for(int i = 0; i < n; ++i){
int h; cin >> h;
a.pb(h);
}
b = a;
for(int i = 1; i < (1 << n); ++i){
vector<int> bb; bb = b;
for(int j = 1; j < n; ++j){
if(i & (1 << j)){
int m = (j + 1) / 2 - 1;
swap(bb[j], bb[m]);
}
}
//for(int j = 0; j < n; ++j) cout << bb[j] << " ";
//cout << endl;
if(a > bb) a = bb;
}
for(int i : a) cout << i << " ";
}
// Running from the daylight...
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
90 ms |
432 KB |
Output is correct |
2 |
Correct |
87 ms |
500 KB |
Output is correct |
3 |
Correct |
94 ms |
432 KB |
Output is correct |
4 |
Correct |
91 ms |
436 KB |
Output is correct |
5 |
Correct |
93 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
90 ms |
432 KB |
Output is correct |
2 |
Correct |
87 ms |
500 KB |
Output is correct |
3 |
Correct |
94 ms |
432 KB |
Output is correct |
4 |
Correct |
91 ms |
436 KB |
Output is correct |
5 |
Correct |
93 ms |
344 KB |
Output is correct |
6 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
90 ms |
432 KB |
Output is correct |
2 |
Correct |
87 ms |
500 KB |
Output is correct |
3 |
Correct |
94 ms |
432 KB |
Output is correct |
4 |
Correct |
91 ms |
436 KB |
Output is correct |
5 |
Correct |
93 ms |
344 KB |
Output is correct |
6 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
90 ms |
432 KB |
Output is correct |
2 |
Correct |
87 ms |
500 KB |
Output is correct |
3 |
Correct |
94 ms |
432 KB |
Output is correct |
4 |
Correct |
91 ms |
436 KB |
Output is correct |
5 |
Correct |
93 ms |
344 KB |
Output is correct |
6 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
90 ms |
432 KB |
Output is correct |
2 |
Correct |
87 ms |
500 KB |
Output is correct |
3 |
Correct |
94 ms |
432 KB |
Output is correct |
4 |
Correct |
91 ms |
436 KB |
Output is correct |
5 |
Correct |
93 ms |
344 KB |
Output is correct |
6 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |