Submission #209424

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2094242020-03-14 07:33:02model_codeSolar Storm (NOI20_solarstorm)C++17
100 / 100
527 ms148288 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
#define ll long long
ll A[N], prefix[N];
int V[N];
int nxt[N], before[N], parent[N];
vector<int> adj[N];
int n, s, ans_start;
ll ans = 0;
vector<int> LOL;
void dfs(int u) {
LOL.push_back(u);
if(u != n) {
int l = before[u];
int r = nxt[LOL[max(0, (int)LOL.size() - s)]] - 1;
ll candidate = prefix[r] - (l == -1 ? 0 : prefix[l]);
//cout<<"DBG --> "<<u<<" : "<<l<<" "<<r<<" : "<<candidate<<endl;
if(candidate > ans) {
ans = candidate;
ans_start = u;
}
}
for(auto v : adj[u]) {
dfs(v);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...