Submission #942622

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9426222024-03-11 01:31:22adaawfSum Zero (RMI20_sumzero)C++17
100 / 100
939 ms19780 KiB
#include <iostream>
#include <algorithm>
using namespace std;
int l[400005][2], f[400005];
pair<long long int, int> c[400005];
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
long long int n;
cin >> n;
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
c[i] = {c[i - 1].first + x, i};
f[i] = -1e9;
}
sort(c, c + n + 1);
for (int i = 1; i <= n; i++) {
if (c[i].first == c[i - 1].first) {
f[c[i].second] = c[i - 1].second;
}
}
f[0] = l[0][0] = -1;
for (int i = 1; i <= n; i++) {
f[i] = max(f[i - 1], f[i]);
l[i][0] = f[i];
}
for (int j = 0; j <= n; j++) {
int h = j;
for (int k = 0; k < 400; k++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...