# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
646824 | Tudy006 | Sum Zero (RMI20_sumzero) | C++14 | 282 ms | 20400 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;
const int NMAX = 4e5;
const int LOGMAX = 18;
int max_left[NMAX + 1][2];
int l[NMAX + 1];
int r[NMAX + 1];
int ans[NMAX + 1];
pair <int, int> sums[NMAX + 1];
void init( int n ) {
long long s = 0;
int x;
for ( int i = 1; i <= n; i ++ ) {
cin >> x;
s += x;
sums[i] = { s, i };
}
sums[0] = { 0, 0 };
sort( sums, sums + n + 1 );
for ( int i = 1; i <= n; i ++ ) {
if ( sums[i].first == sums[i - 1].first )
max_left[sums[i].second][0] = sums[i - 1].second + 1;
}
for ( int i = 1; i <= n; i ++ ) {
max_left[i][0] = max( max_left[i][0], max_left[i - 1][0] );
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |