# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1206997 | friendiks | Permutation Game (APIO25_permgame) | C++20 | 0 ms | 328 KiB |
#ifndef LOCAL
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rnd(52);
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename V>
using table = gp_hash_table<T, V>;
using i128 = __int128;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
const ll INF = 2e18;
const int inf = 2e9;
const int maxn = 1e5;
const int MOD = 988244353;
const ld pi = acos(-1);
const int P = 5167;
const int L = 26;
const ld EPS = 1e-7;
template<typename T, typename V>
void fill(T &container, V value) {
for (auto &c: container)
c = value;
}
int Bob(vector<int> t);
int Alice(int m, int e, vector<int> u, vector<int> v, int n, vector<int> p) {
vector<int> pos(n);
for (int i = 0; i < n; ++i) {
pos[p[i]] = i;
}
for (int i = 0; i < n; ++i) {
if (p[i] == i) {
continue;
}
int current_idx_of_value_i = pos[i];
vector<int> t_for_bob(m); // m == 2
t_for_bob[0] = i;
t_for_bob[1] = current_idx_of_value_i;
Bob(t_for_bob);
int val_at_i = p[i];
int val_at_current_idx = p[current_idx_of_value_i];
swap(p[i], p[current_idx_of_value_i]);
pos[val_at_i] = current_idx_of_value_i;
pos[val_at_current_idx] = i;
}
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |