Submission #956190

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9561902024-04-01 09:25:02IwanttobreakfreeElection (BOI18_election)C++17
0 / 100
2 ms4440 KiB
#include <bits/stdc++.h>
using namespace std;
const int max_n = 5e5+2;
struct Node{
int valL = 0, valR = 0, valLC = 0, valRC = 0;
};
Node t[4*max_n];
// a > 0, a tiene t[a] platos sin pagar
Node merge(Node a, Node b) {
Node ans;
ans.valLC = max(0, a.valLC+b.valLC-b.valL-a.valL);
ans.valRC = max(0, a.valRC+b.valRC-b.valR-a.valR);
ans.valL = a.valL + max(0, b.valL-a.valLC);
ans.valR = b.valR + max(0, a.valR-b.valRC);
return ans;
}
Node updateN(Node x, int p) {
if (p > 0) x.valL = x.valR = x.valL+1;
else x.valLC = x.valRC = x.valLC+1;
return x;
}
void update_p(int n, int l, int r, int p, int x) {
if (l > p || r < p) return;
if (l == r) {
t[n] = updateN(t[n],x);
}
else {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...