# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
77495 |
2018-09-28T08:44:33 Z |
aryanc403 |
Vudu (COCI15_vudu) |
C++14 |
|
668 ms |
66560 KB |
//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
vudu.cpp:25:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(disable:4996)
vudu.cpp:26:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(linker, "/stack:200000000")
vudu.cpp: In function 'int main()':
vudu.cpp:92:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf(" %lld %lld",&n,&k);
~~~~~^~~~~~~~~~~~~~~~~~~~
vudu.cpp:99:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf(" %lld",&in);
~~~~~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
632 KB |
Output isn't correct |
2 |
Incorrect |
6 ms |
672 KB |
Output isn't correct |
3 |
Incorrect |
5 ms |
764 KB |
Output isn't correct |
4 |
Incorrect |
668 ms |
32812 KB |
Output isn't correct |
5 |
Incorrect |
393 ms |
32812 KB |
Output isn't correct |
6 |
Incorrect |
558 ms |
44136 KB |
Output isn't correct |
7 |
Incorrect |
591 ms |
53564 KB |
Output isn't correct |
8 |
Incorrect |
463 ms |
58444 KB |
Output isn't correct |
9 |
Runtime error |
664 ms |
66560 KB |
Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
10 |
Runtime error |
566 ms |
66560 KB |
Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |