# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
380580 | Aryan_Raina | Vudu (COCI15_vudu) | C++14 | 1098 ms | 59116 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |