# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
315187 | 2qbingxuan | Cat (info1cup19_cat) | C++14 | 597 ms | 13356 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#ifdef local
#define debug(args...) ppbx(#args, args)
template <typename ...T> void ppbx(const char *s, T ...args) {
int cnt = sizeof...(T);
(std::cerr << "(" << s << ") = (" , ... , (std::cerr << args << (--cnt ? ", " : ")\n")));
}
#else
#define debug(...) ((void)0)
#endif // local
#define pb emplace_back
#define all(v) begin(v), end(v)
using namespace std;
using ll = long long;
void solve() {
int n;
cin >> n;
vector<int> p(n);
for(int i = 0; i < n; i++) cin >> p[i], --p[i];
for(int i = 0; i < n; i++) if(p[i] + p[n-1-i] != n-1) return cout << -1 << '\n', void();
vector<pair<int,int>> ans;
int H = n/2;
vector<int> pos(H);
for(int i = 0; i < H; i++) pos[p[i] < H ? p[i] : n-1-p[i]] = i;
vector<int> vis(H);
int last = -1;
auto go = [&](int a, int b) {
swap(p[a], p[b]);
swap(p[n-1-a], p[n-1-b]);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |