#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<long long, null_type,less_equal<long long>, rb_tree_tag,tree_order_statistics_node_update>
int main(){
ios::sync_with_stdio(0);cin.tie(0);
int x,k;cin>>x;
long long a[x],ans=0;
for(int i=0;i<x;i++)cin>>a[i];
cin>>k;
for(int i=0;i<x;i++)a[i]-=k;
ordered_set s;
s.insert(0);
long long xd=0;
for(int i=0;i<x;i++){
xd+=a[i];
ans+=s.order_of_key(xd+1);
s.insert(xd);
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
852 KB |
Output is correct |
2 |
Correct |
2 ms |
724 KB |
Output is correct |
3 |
Correct |
3 ms |
596 KB |
Output is correct |
4 |
Runtime error |
556 ms |
65536 KB |
Execution killed with signal 9 |
5 |
Correct |
311 ms |
38812 KB |
Output is correct |
6 |
Correct |
489 ms |
60496 KB |
Output is correct |
7 |
Correct |
491 ms |
62944 KB |
Output is correct |
8 |
Correct |
461 ms |
54656 KB |
Output is correct |
9 |
Runtime error |
471 ms |
65536 KB |
Execution killed with signal 9 |
10 |
Correct |
501 ms |
61372 KB |
Output is correct |