# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
946597 | MohammadAbduljalil | Vudu (COCI15_vudu) | C++17 | 516 ms | 65536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/extc++.h>
#define int long long
using namespace std;
using namespace __gnu_pbds;
int const mxN = 3e5+5;
int const mxN2 = 1e6;
int a[mxN2 + 5];
signed main() {
ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
int n,p, ans = 0;
cin>>n;
for(int i=0; i<n; i++) cin>>a[i];
cin>>p;
tree<int,null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> st;
st.insert(p);
for(int i=0; i<n; i++) {
a[i] += (i? a[i-1]:0);
int x = a[i] - p*i;
ans += st.order_of_key(x+1);
st.insert(x);
}
cout<<ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |