Submission #15420

# Submission time Handle Problem Language Result Execution time Memory
15420 2015-07-12T07:25:32 Z xhae 달리는 게임 (kriii3_E) C++14
26 / 70
1000 ms 5628 KB
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;

int main()
{
  int n;
  scanf("%d", &n);

  vector<int> val(n);
  for (int i=0; i<n; i++)
    scanf("%d", &val[i]);

  long long res = 0;

  long long mult = 0;
  for (int i=0; i<n; i++) {
    long long sum = 0;
    for (int j=i; j<n; j++) {
      sum += val[j];
      if (sum >= 0) break;
    }
    if (sum >= 0) {
      mult ++;
      res += mult * val[i];
    } else mult = 0;
  }
  printf("%lld\n", res);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1720 KB Output is correct
2 Correct 0 ms 1720 KB Output is correct
3 Correct 0 ms 1720 KB Output is correct
4 Correct 0 ms 1720 KB Output is correct
5 Correct 0 ms 1720 KB Output is correct
6 Correct 0 ms 1720 KB Output is correct
7 Correct 0 ms 1720 KB Output is correct
8 Correct 0 ms 1720 KB Output is correct
9 Correct 0 ms 1720 KB Output is correct
10 Correct 0 ms 1720 KB Output is correct
11 Correct 0 ms 1720 KB Output is correct
12 Correct 0 ms 1720 KB Output is correct
13 Correct 0 ms 1720 KB Output is correct
14 Correct 0 ms 1720 KB Output is correct
15 Correct 0 ms 1720 KB Output is correct
16 Correct 0 ms 1720 KB Output is correct
17 Correct 0 ms 1720 KB Output is correct
18 Correct 0 ms 1720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1916 KB Output is correct
2 Correct 19 ms 1916 KB Output is correct
3 Correct 18 ms 1916 KB Output is correct
4 Correct 21 ms 2112 KB Output is correct
5 Correct 388 ms 2112 KB Output is correct
6 Correct 46 ms 2112 KB Output is correct
7 Correct 342 ms 3676 KB Output is correct
8 Execution timed out 1000 ms 5628 KB Program timed out
9 Halted 0 ms 0 KB -