# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
549283 | kevinxiehk | Sum Zero (RMI20_sumzero) | C++17 | 296 ms | 18448 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>
#define mp make_pair
#define pb emplace_back
#define fi first
#define se second
// #define int long long
#define inf 1e9
#define ick cout<<"ickbmi32.9\n"
using namespace std;
int nxt[400005];
long long ps;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n;
cin >> n;
unordered_map<long long, int> la;
la.reserve(n / 100);
int t;
for(int i = 1; i <= n; i++) {
cin >> t;
ps += t;
nxt[i] = n + 1;
if(la[ps] != 0 || ps == 0) {
nxt[la[ps] + 1] = min(nxt[la[ps] + 1], i);
}
la[ps] = i;
}
la.clear();
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |