# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
795024 | PoonYaPat | Sjeckanje (COCI21_sjeckanje) | C++14 | 977 ms | 45880 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;
ll s[1<<19][3][3],c[200005],lz[1<<19];
int n,q;
void merge(int a, int b, int res) {
for (int i=0; i<3; ++i) {
for (int j=0; j<3; ++j) {
s[res][i][j]=-1e15;
for (int k=0; k<3; ++k) s[res][i][j]=max(s[res][i][j],s[a][i][k]+s[b][2-k][j]);
if (i!=1) s[res][i][j]=max(s[res][i][j],s[b][i][j]);
if (j!=1) s[res][i][j]=max(s[res][i][j],s[a][i][j]);
}
}
}
void push(int l, int r, int idx) {
if (lz[idx]==-1e16) return;
if (l!=r) {
for (int i=0; i<3; ++i) {
for (int j=0; j<3; ++j) {
if (i==0) s[idx][i][j]-=lz[idx];
if (i==2) s[idx][i][j]+=lz[idx];
if (j==0) s[idx][i][j]-=lz[idx];
if (j==2) s[idx][i][j]+=lz[idx];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |