# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
856095 | mraron | Sum Zero (RMI20_sumzero) | C++14 | 251 ms | 15064 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<iostream>
#include<functional>
#include<vector>
#include<algorithm>
using namespace std;
const int MAXN=400001;
using ll = long long ;
int n;
int q;
int qL[MAXN], qR[MAXN], qs[MAXN];
int pref[MAXN];
int last[MAXN];
int ans[MAXN], where[MAXN], best[MAXN];
int mid;
void handle(int i, bool left) {
#define chkmx(val, ww) if(ans[i]<val || (ans[i]==val && abs(mid-ww)>abs(mid-where[i]))) {ans[i]=val;where[i]=ww;}
ans[i]=0;
where[i]=i;
if(left && i+1<=mid) {
chkmx(ans[i+1], where[i+1]);
}
if(!left && i-1>=mid+1) {
chkmx(ans[i-1], where[i-1]);
}
int curr_pref=pref[i];
if(last[curr_pref]!=-1) {
int w=last[curr_pref];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |