#include <bits/stdc++.h>
using namespace std;
#define ll long long
long long qs[1000001];
int main()
{
cin.tie(0)->sync_with_stdio(false);
cout.tie(0);
int n;
cin >> n;
for (int i = 1;i <= n;i++) {
cin >> qs[i];
qs[i]+=qs[i-1];
}
int p;
cin >> p;
ll cnt=0;
for (int i=1;i<=n;i++) {
for (int j=i;j<=n;j++) {
if ((qs[j]-qs[i-1])/(j-i+1) >= p) {
cnt++;
}
}
}
cout << cnt;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
182 ms |
532 KB |
Output is correct |
2 |
Correct |
102 ms |
520 KB |
Output is correct |
3 |
Correct |
94 ms |
504 KB |
Output is correct |
4 |
Execution timed out |
1034 ms |
17232 KB |
Time limit exceeded |
5 |
Execution timed out |
1044 ms |
9812 KB |
Time limit exceeded |
6 |
Execution timed out |
1036 ms |
15392 KB |
Time limit exceeded |
7 |
Execution timed out |
1020 ms |
15972 KB |
Time limit exceeded |
8 |
Execution timed out |
1038 ms |
14160 KB |
Time limit exceeded |
9 |
Execution timed out |
1050 ms |
17748 KB |
Time limit exceeded |
10 |
Execution timed out |
1059 ms |
15596 KB |
Time limit exceeded |