# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
681037 | minhnhatnoe | Collecting Stamps 3 (JOI20_ho_t3) | C++14 | 640 ms | 129684 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>
using namespace std;
typedef long long ll;
ll cycle_len;
vector<pair<int, int>> a;
vector<vector<vector<array<ll, 2>>>> dp;
// Counter-clockwise
ll get_dist(ll l, ll r){
if (l < -1 || l > a.size()) return 1e15;
if (r < -1 || r > a.size()) return 1e15;
if (l == -1 || l == a.size()) l = 0;
else l = a[l].first;
if (r == -1 || r == a.size()) r = 0;
else r = a[r].first;
return (l + cycle_len - r) % cycle_len;
}
ll get_time(int idx){
if (idx == -1 || idx == a.size()) return -1;
return a[idx].second;
}
ll f(int l, int r, int picked, bool lr){
if (l == -1 || l == a.size()+1 || r == -1 || r == a.size()+1 || picked == -1) return 1e15;
if (l + r > a.size()) return 1e15;
if (l == 0 && r == 0){
if (picked) return 1e15;
return 0;
}
ll& value = dp[l][r][picked][lr];
if (value != -1) return value;
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... |