#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
#include <cmath>
#include <map>
#include <random>
#include <cassert>
#include <ctime>
#include <cstdlib>
#include <queue>
#include <limits.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N; cin >> N;
vector<int> arr(N); for (int i = 0; i < N; i++) cin >> arr[i];
vector<int> pref = {0}; for (int i = 0; i < N; i++) pref.push_back(pref.back() + arr[i]);
int P; cin >> P;
int c = 0;
for (int r = 0; r < N; r++) {
for (int l = 0; l <= r; l++) {
if (pref[r + 1] - P * r - P >= pref[l] -P * l) {
c++;
}
}
}
cout << c;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
456 KB |
Output is correct |
2 |
Correct |
17 ms |
340 KB |
Output is correct |
3 |
Correct |
15 ms |
340 KB |
Output is correct |
4 |
Execution timed out |
1052 ms |
17664 KB |
Time limit exceeded |
5 |
Execution timed out |
1055 ms |
11920 KB |
Time limit exceeded |
6 |
Execution timed out |
1075 ms |
16192 KB |
Time limit exceeded |
7 |
Execution timed out |
1066 ms |
16600 KB |
Time limit exceeded |
8 |
Execution timed out |
1072 ms |
15172 KB |
Time limit exceeded |
9 |
Execution timed out |
1058 ms |
18156 KB |
Time limit exceeded |
10 |
Execution timed out |
1059 ms |
16324 KB |
Time limit exceeded |