# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
464538 | amunduzbaev | Game (eJOI20_game) | C++14 | 6 ms | 972 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;
const int N = 25;
vector<int> edges[N*N], cycle, path;
int used[N*N], cntv, cnte;
map<array<int, 4>, int> mem;
//~ 0 cycle
//~ 1 path
//~ cycle, path, left for us, type
int rec(int i, int j, int left, int t){
//~ cout<<i<<" "<<j<<" "<<left<<" "<<t<<"\n";
if(i + 1 == (int)cycle.size() && j + 1 == (int)path.size()) return left;
if(mem.count({i, j, left, t})) return mem[{i, j, left, t}];
int& res = mem[{i, j, left, t}];
res = -(1e9+7);
if(t == 0 && left >= 4){
res = max(res, left - 4 - rec(i, j, 4, -1));
} if(t == 1 && left > 2){
res = max(res, left - 2 - rec(i, j, 2, -1));
}
if(i + 1 < (int)cycle.size()){
res = max(res, left - rec(i + 1, j, cycle[i + 1], 0));
} if(j + 1 < (int)path.size()){
res = max(res, left - rec(i, j + 1, path[j + 1], 1));
# | 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... |