# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
985261 | michified | Sjeckanje (COCI21_sjeckanje) | C++17 | 604 ms | 61732 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>
#define ll long long
#define lid id * 2 + 1
#define rid id * 2 + 2
using namespace std;
struct node_t {
ll nlnr, nlyr, ylnr, ylyr, l, r;
};
int n, q;
vector<node_t> st;
vector<ll> d;
node_t merge(node_t& a, node_t& b) {
node_t res;
bool can = (a.r >= 0 and b.l >= 0) or (a.r <= 0 and b.l <= 0);
res.nlnr = max(max(a.nlyr + b.nlnr, a.nlnr + b.nlnr),
max(a.nlnr + b.ylnr, can ? a.nlyr + b.ylnr : -1));
res.ylnr = max(max(a.ylyr + b.nlnr, a.ylnr + b.nlnr),
max(a.ylnr + b.ylnr, can ? a.ylyr + b.ylnr : -1));
res.nlyr = max(max(a.nlyr + b.nlyr, a.nlnr + b.nlyr),
max(a.nlnr + b.ylyr, can ? a.nlyr + b.ylyr : -1));
res.ylyr = max(max(a.ylyr + b.nlyr, a.ylnr + b.nlyr),
max(a.ylnr + b.ylyr, can ? a.ylyr + b.ylyr : -1));
res.l = a.l;
res.r = b.r;
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |