제출 #594928

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
5949282022-07-13 07:20:23czhang2718Dynamic Diameter (CEOI19_diameter)C++17
49 / 100
226 ms37656 KiB
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int N=2e5+1;
int n, q, maxW;
vector<int> adj[N];
int edge[N][2];
int W[N];
int ti=-1;
int fst[N], lst[N];
vector<int> et;
ll path[N];
ll mx[4*N];
ll mn[4*N];
ll pref[4*N];
ll suf[4*N];
ll seg[4*N];
ll lazy[4*N];
void pull(int x){
mx[x]=max(mx[2*x+1], mx[2*x+2]);
mn[x]=min(mn[2*x+1], mn[2*x+2]);
pref[x]=max({pref[2*x+1], pref[2*x+2], mx[2*x+2]-2*mn[2*x+1]});
suf[x]=max({suf[2*x+1], suf[2*x+2], mx[2*x+1]-2*mn[2*x+2]});
// cout << "seg " << x << " = max " << seg[2*x+1] << ", " << seg[2*x+2] << ", " << pref[2*x+2] << "+" << mx[2*x+1] <<", " << mx[2*x+2] << "+" << suf[2*x+1] << "\n";
seg[x]=max({seg[2*x+1], seg[2*x+2], pref[2*x+2]+mx[2*x+1], mx[2*x+2]+suf[2*x+1]});
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...