# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
89961 |
2018-12-19T09:56:56 Z |
vex |
Vudu (COCI15_vudu) |
C++14 |
|
646 ms |
37160 KB |
#include <bits/stdc++.h>
#define maxn 1000005
#define plli pair<long long,int>
using namespace std;
int n;
plli a[maxn];
long long p;
int tree[maxn]={0};
int manji(int x)
{
x--;
int sol=0;
while(x>0)
{
sol+=tree[x];
x-=x&-x;
}
return sol;
}
void update(int x)
{
while(x<=n)
{
tree[x]++;
x+=x&-x;
}
}
int main()
{
//ios_base::sync_with_stdio(false);
//cin.tie(nullptr);
//cout.tie(nullptr);
cin>>n;
a[0]={0,0};
for(int i=0;i<n;i++)
{
cin>>a[i+1].first;
a[i+1].first+=a[i].first;
a[i+1].second=i+1;
}
cin>>p;
for(int i=0;i<=n;i++)
{
a[i].first-=p*a[i].second;
}
sort(a,a+n+1);
int sol=0;
for(int i=0;i<=n;i++)a[i].second++;
for(int i=0;i<=n;i++)
{
sol+=manji(a[i].second);
update(a[i].second);
}
cout<<sol<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
504 KB |
Output is correct |
2 |
Correct |
4 ms |
532 KB |
Output is correct |
3 |
Correct |
4 ms |
632 KB |
Output is correct |
4 |
Incorrect |
618 ms |
28924 KB |
Output isn't correct |
5 |
Incorrect |
339 ms |
28924 KB |
Output isn't correct |
6 |
Incorrect |
535 ms |
34388 KB |
Output isn't correct |
7 |
Incorrect |
552 ms |
35116 KB |
Output isn't correct |
8 |
Incorrect |
489 ms |
35116 KB |
Output isn't correct |
9 |
Incorrect |
646 ms |
37160 KB |
Output isn't correct |
10 |
Incorrect |
546 ms |
37160 KB |
Output isn't correct |