# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
646648 | Vanilla | Sum Zero (RMI20_sumzero) | C++17 | 474 ms | 47108 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 int64;
const int maxn = 4e5 + 5;
const int lg = 19;
int64 a [maxn];
map <int64, int> ps;
int l [maxn];
int jump [maxn][lg];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for (int i = 0; i <= n + 1; i++){
l[i] = n + 1;
}
ps[0] = 0;
int64 s = 0;
for (int i = 1; i <= n; i++){
cin >> a[i];
s+=a[i];
if (ps.count(s)) {
l[ps[s] + 1] = i;
}
ps[s] = i;
}
for (int i = n; i >= 1; i--){
l[i] = min(l[i], l[i + 1]);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |