# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
939880 | Litusiano | Progression (NOI20_progression) | C++17 | 886 ms | 91332 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;
#define int long long
#define endl "\n"
const int INF = 1e15;
struct Node{
pair<int,int> mxl = {-INF,INF}; // tot, val
pair<int,int> mxr = {-INF,INF}; // tot, val
pair<int,int> tot = {-INF,INF}; // tot, val
int sz = 1;
int sum = 0;
};
struct SegTree{
int n;
vector<Node> seg; //mxl,
vector<pair<bool,int>> lazy; // 0 add, 1 set
Node merge(Node idx, Node idx1){
Node ans;
ans.sz = idx.sz + idx1.sz;
ans.sum = idx.sum + idx1.sum;
// if(idx.mxl.first == -INF && idx1.mxl.first == -INF) return ans; // both are null nodes
// if(idx1.mxl.first == -INF) return idx; // just second is a null node
// if(idx.mxl.first == -INF) return idx1;
ans.mxl = idx.mxl;
pair<int,int> templeft = idx.mxl; //idx ALWAYS IN THE LEFT
if(idx.mxl.first == idx.sz){
if(idx1.mxl.second == idx.mxl.second) templeft = {idx.sz + idx1.mxl.first, idx1.mxl.second};// join both lefts
else templeft = idx.mxl;
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |