# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
875342 | serifefedartar | Vudu (COCI15_vudu) | C++17 | 468 ms | 65536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define s second
#define f first
typedef long long ll;
const ll MOD = 998244353;
const ll LOGN = 20;
const ll MAXN = 1e6 + 10;
vector<ll> A;
tree<pair<ll,int>, null_type, less<pair<ll,int>>, rb_tree_tag, tree_order_statistics_node_update> s;
int main() {
fast
int N;
ll P;
cin >> N;
A = vector<ll>(N+1);
for (int i = 1; i <= N; i++) {
cin >> A[i];
A[i] += A[i-1];
}
cin >> P;
ll ans = 0;
for (ll i = 1; i <= N; i++) {
s.insert(make_pair(P * i - A[i-1], i));
ans += s.size() - s.order_of_key(make_pair(P * i - A[i] + P, -1));
}
cout << ans << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |