Submission #1030119

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10301192024-07-21 20:36:49parsadox2Sjeckanje (COCI21_sjeckanje)C++17
110 / 110
258 ms38184 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5 + 10;
int n , a[N] , d[N] , q;
struct SEG{
struct NODE{
int dp[2][2];
NODE()
{
memset(dp , 0 , sizeof dp);
}
};
NODE t[N << 2];
NODE Merge(NODE lc , NODE rc , int lim)
{
NODE res;
if((d[lim] < 0 && d[lim - 1] > 0) || (d[lim] > 0 && d[lim - 1] < 0))
{
for(int i = 0 ; i < 2 ; i++) for(int j = 0 ; j < 2 ; j++)
res.dp[i][j] = max(lc.dp[i][0] + rc.dp[1][j] , lc.dp[i][1] + rc.dp[0][j]);
}
else
{
for(int i = 0 ; i < 2 ; i++) for(int j = 0 ; j < 2 ; j++)
res.dp[i][j] = lc.dp[i][1] + rc.dp[1][j];
}
return res;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...