# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
684800 | US3RN4M3 | Vudu (COCI15_vudu) | C++17 | 891 ms | 65536 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<ext/pb_ds/assoc_container.hpp>
#include<bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
typedef tree<pair<ll, int>, null_type, less<pair<ll, int>>, rb_tree_tag, tree_order_statistics_node_update> ost;
main() {
int n; cin >> n;
vector<int> nums(n);
for(int & i : nums) cin >> i;
ll p; cin >> p;
ost t;
ll sum = 0;
ll ans = 0;
t.insert({0, -1});
for(int i = 0; i < n; i++) {
sum += nums[i];
ll goal = p * (i + 1);
ans += i + 1 - t.order_of_key({goal - sum, -1});
t.insert({goal - sum, i});
}
cout << ans << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |