# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
380580 |
2021-03-22T11:58:13 Z |
Aryan_Raina |
Vudu (COCI15_vudu) |
C++14 |
|
1000 ms |
59116 KB |
#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;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define int long long
#define ld long double
#define ar array
const int INF = 1e17;
const int MOD = 1e9;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin>>n;
vector<int> a(n);
for (int &i : a) cin>>i;
oset s; s.insert(0);
int p; cin>>p; int psum = 0;
int ans = 0;
for (int i = 0; i < n; i++) {
psum += a[i];
int diff = psum - (i+1)*p;
ans += s.order_of_key(diff+1);
s.insert(diff);
}
cout<<ans<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
748 KB |
Output is correct |
2 |
Correct |
3 ms |
748 KB |
Output is correct |
3 |
Correct |
3 ms |
620 KB |
Output is correct |
4 |
Execution timed out |
1016 ms |
57324 KB |
Time limit exceeded |
5 |
Incorrect |
596 ms |
35564 KB |
Output isn't correct |
6 |
Execution timed out |
1067 ms |
55456 KB |
Time limit exceeded |
7 |
Execution timed out |
1098 ms |
57836 KB |
Time limit exceeded |
8 |
Incorrect |
954 ms |
50072 KB |
Output isn't correct |
9 |
Execution timed out |
1032 ms |
59116 KB |
Time limit exceeded |
10 |
Execution timed out |
1064 ms |
56172 KB |
Time limit exceeded |