Submission #735293

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7352932023-05-03 20:59:26MODDIElection (BOI18_election)C++14
100 / 100
1595 ms27872 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<long long, long long> pll;
typedef pair<int,int> pii;
typedef vector<long long> vl;
typedef vector<int> vi;
int n;
string str;
struct state{
int ans;
int tot;
int pref;
int suf;
};
state neutral;
state tree[4 * 500100];
state merge(state a, state b){
if(a.tot==-(1e9))return b;if(b.tot==-(1e9))return a;
state c;
c.tot=a.tot+b.tot;
c.pref=std::max(a.tot+b.pref,a.pref);
c.suf=std::max(b.tot+a.suf,b.suf);
c.ans=std::max(std::max(a.ans+b.tot,a.tot+b.ans),a.pref+b.suf);
return c;
}
void update(int node, int l, int r, state put, int pos){
if(l == r && l == pos){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

election.cpp: In function 'state merge(state, state)':
election.cpp:21:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   21 |     if(a.tot==-(1e9))return b;if(b.tot==-(1e9))return a;
      |     ^~
election.cpp:21:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   21 |     if(a.tot==-(1e9))return b;if(b.tot==-(1e9))return a;
      |                               ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...