# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
438643 | fleimgruber | Dungeons Game (IOI21_dungeons) | C++17 | 7115 ms | 737016 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.
// this solves subtask 1, 3, 4, 5. the complexity is alright,
// but for larger n we get MLE. instead of binary lifting, we
// should probably use some other base, HLD, those linear jump pointers..
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 50001; // subtasks 1, 3, 4, 5
const int MAX_LOG = 25; // 2^24 > 10^7
// dp[i][j][k] = we're at i, simulate for 2^j steps and
// win against an opponent if strength < 2^k (we don't gain strength)
struct {
int end; // where do we end up at?
long long gained; // total strength gained on the path
// max(sum(gained) - opponent) along the simulation,
// for all opponents we lose against
long long max;
} dp[MAX_N][MAX_LOG][MAX_LOG];
int n, s[MAX_N], w[MAX_N];
// because p[i] = s[i], every time we lose, our strength doubles
struct Subtask2 {
struct {
int end;
long long gained;
long long min; // min(sum(gained) - opponent)
} dp[400001][MAX_LOG];
int l[400001];
# | 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... |