Submission #761489

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7614892023-06-19 19:21:30raysh07Sequence (APIO23_sequence)C++17
41 / 100
2075 ms56260 KiB
#include <bits/stdc++.h>
using namespace std;
struct Node{
int prefmx, prefmn, sufmx, sufmn, tot, val;
};
const int N = 5e5 + 69;
Node seg[4 * N];
Node res;
int n;
Node combine(Node a, Node b){
Node ok;
ok.tot = a.tot + b.tot;
ok.prefmx = max(a.prefmx, b.prefmx + a.tot);
ok.prefmn = min(a.prefmn, b.prefmn + a.tot);
ok.sufmx = max(b.sufmx, a.sufmx + b.tot);
ok.sufmn = min(b.sufmn, a.sufmn + b.tot);
ok.val = a.val + b.val;
return ok;
}
void upd(int l, int r, int pos, int qp, int v){
if (l == r){
seg[pos].tot = v;
seg[pos].prefmx = max(v, 0);
seg[pos].prefmn = min(v, 0);
seg[pos].sufmx = max(v, 0);
seg[pos].sufmn = min(v, 0);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...