# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
615848 | zhangjishen | Sjeckanje (COCI21_sjeckanje) | C++98 | 565 ms | 37768 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 10;
// Node structure
struct Node{
ll lv, rv, dp[2][2];
};
Node merge(Node L, Node R){
Node ans;
ans.lv = L.lv; ans.rv = R.rv;
if(L.rv * R.lv >= 0){
ans.dp[0][0] = L.dp[0][0] + R.dp[0][0];
ans.dp[0][1] = L.dp[0][0] + R.dp[0][1];
ans.dp[1][0] = L.dp[1][0] + R.dp[0][0];
ans.dp[1][1] = L.dp[1][0] + R.dp[0][1];
}else{
ans.dp[0][0] = max(L.dp[0][1] + R.dp[0][0], L.dp[0][0] + R.dp[1][0]);
ans.dp[0][1] = max(L.dp[0][1] + R.dp[0][1], L.dp[0][0] + R.dp[1][1]);
ans.dp[1][0] = max(L.dp[1][1] + R.dp[0][0], L.dp[1][0] + R.dp[1][0]);
ans.dp[1][1] = max(L.dp[1][1] + R.dp[0][1], L.dp[1][0] + R.dp[1][1]);
}
return ans;
}
// Segment Tree
Node t[MAXN * 4];
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |