| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 410109 | rqi | Vudu (COCI15_vudu) | C++14 | 659 ms | 65540 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ins insert
#define mp make_pair
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ook order_of_key
const int mx = 1000005;
int N;
ll a[mx];
ll P;
int main(){
cin.tie(0)->sync_with_stdio(0);
cin >> N;
for(int i = 1; i <= N; i++){
cin >> a[i];
}
cin >> P;
for(int i = 1; i <= N; i++){
a[i]-=P;
}
for(int i = 1; i <= N; i++){
a[i]+=a[i-1];
}
Tree<pair<ll, int>> t;
t.ins(mp(0, 0));
ll ans = 0;
for(int i = 1; i <= N; i++){
ll val = ll(t.ook(mp(a[i], N+5)));
//cout << "i, val: " << i << " " << val << "\n";
ans+=val;
t.ins(mp(a[i], i));
}
cout << ans << "\n";
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
