Submission #707534

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7075342023-03-09 07:50:55ToroTNElection (BOI18_election)C++14
100 / 100
462 ms27332 KiB
#include<bits/stdc++.h>
using namespace std;
int n,t,x,y;
char s[500005];
struct node
{
int l,r,sum,ans;
} seg[2000005];
node merge(node lft,node rht)
{
node res;
res.sum=lft.sum+rht.sum;
res.l=max(lft.l,lft.sum+rht.l);
res.r=max(rht.r,rht.sum+lft.r);
res.ans=max({lft.l+rht.r,lft.ans+rht.sum,rht.ans+lft.sum});
return res;
}
void build(int tree,int st,int ed)
{
int md=(st+ed)/2;
if(st==ed)
{
if(s[st]=='T')
{
seg[tree].l=seg[tree].r=seg[tree].sum=seg[tree].ans=1;
}else
{
seg[tree].l=seg[tree].r=seg[tree].ans=0;
seg[tree].sum=-1;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

election.cpp: In function 'int main()':
election.cpp:53:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   53 |     cin >> n >> s+1;
      |                 ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...