# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
77496 | aryanc403 | Vudu (COCI15_vudu) | C++14 | 665 ms | 36456 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.
//Invitation to ICO Preparatory Contest #1
//ICOP1901
//mean array
/************************************************************************************************************************************************************************************
* *
* *
* **************** ************** * * **************** * * **************** * * **************** **************** *
* * * * * * * * * ** * * * * * * * *
* * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * *
* **************** ************** ***************** **************** * * * * **************** * * **************** *
* * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * *
* * * * * * * * * ** * * * * * *
* * * * * * * * * * **************** * **************** **************** *
* *
* *
************************************************************************************************************************************************************************************/
#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include<iostream>
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define fo(i,n) for(i=0;i<(n);++i)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define MAX 100002
#define PI 3.1415926535897932384626433832795
typedef long long int lli;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;
const lli INF = 0xFFFFFFFFFFFFFFFL;
const lli mod = 1000000007L;
lli T,n,i,m,j,k,in,cnt,l,sz;
vi a;
vi :: iterator it;
void SORT(vi &a)
{
lli sz=(lli)a.size();
if(sz<=1)
return;
vi b,c;
b.clear();a.reserve(sz/2+2);
c.clear();a.reserve(sz/2+2);
lli i=0;
fo(i,sz/2)
b.pb(a[i]);
while(i<sz)
{
c.pb(a[i]);
i++;
}
SORT(b);
SORT(c);
b.pb(INF);
c.pb(INF);
lli j=0,k=0,l=0;
fo(i,sz)
{
if(b[j]<c[k])
a[i]=b[j++];
else
{
while(l<sz/2&&c[k]>=b[l]+T)
l++;
cnt+=sz/2-l;
a[i]=c[k++];
}
}
}
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
scanf(" %lld %lld",&n,&k);
a.clear();a.reserve(n+4);
lli sum=0;
a.pb(0);
cnt=0;
fo(i,n)
{
scanf(" %lld",&in);
sum+=in-k;
a.pb(sum);
}
SORT(a);
cnt=n*(n+1)/2-cnt;
printf("%lld",cnt);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |