Submission #812554

# Submission time Handle Problem Language Result Execution time Memory
812554 2023-08-07T09:15:56 Z tch1cherin Swap (BOI16_swap) C++17
10 / 100
48 ms 280 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> p(n);
	for (int &v : p) {
		cin >> v;
	}
	vector<int> ans = p;
	for (int mask = 0; mask < (1 << n); mask += 2) {
		vector<int> b = p;
		for (int i = 1; i < n; i++) {
			if ((mask >> i) & 1) {
				swap(b[i], b[(i + 1) / 2 - 1]);
			}
		}
		ans = min(ans, b);
	}
	for (int i = 0; i < n; i++) {
		cout << ans[i] << " \n"[i + 1 == n];
	}
}
# Verdict Execution time Memory Grader output
1 Correct 46 ms 276 KB Output is correct
2 Correct 43 ms 280 KB Output is correct
3 Correct 48 ms 280 KB Output is correct
4 Correct 45 ms 212 KB Output is correct
5 Correct 43 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 276 KB Output is correct
2 Correct 43 ms 280 KB Output is correct
3 Correct 48 ms 280 KB Output is correct
4 Correct 45 ms 212 KB Output is correct
5 Correct 43 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 46 ms 276 KB Output is correct
2 Correct 43 ms 280 KB Output is correct
3 Correct 48 ms 280 KB Output is correct
4 Correct 45 ms 212 KB Output is correct
5 Correct 43 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 46 ms 276 KB Output is correct
2 Correct 43 ms 280 KB Output is correct
3 Correct 48 ms 280 KB Output is correct
4 Correct 45 ms 212 KB Output is correct
5 Correct 43 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 46 ms 276 KB Output is correct
2 Correct 43 ms 280 KB Output is correct
3 Correct 48 ms 280 KB Output is correct
4 Correct 45 ms 212 KB Output is correct
5 Correct 43 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -