# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
93439 | popovicirobert | Swap (BOI16_swap) | C++14 | 40 ms | 4468 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>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define ld long double
// 217
// 44
using namespace std;
const int INF = 1e9;
const int MAXN = (int) 1e5;
int arr[3 * MAXN + 1];
map < pair <int, int>, int > mp;
int solve(int pos, int val) {
if(mp.count({pos, val})) {
return mp[{pos, val}];
}
if(val < min(arr[2 * pos], arr[2 * pos + 1])) {
return pos;
}
if(arr[2 * pos] < arr[2 * pos + 1]) {
return mp[{pos, val}] = solve(2 * pos, val);
}
int mn = min(arr[2 * pos], val);
// b c a
if(solve(2 * pos, mn) < solve(2 * pos + 1, mn)) {
# | 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... |