Submission #56236

# Submission time Handle Problem Language Result Execution time Memory
56236 2018-07-10T13:02:46 Z WA_TLE Horses (IOI15_horses) C++14
Compilation error
0 ms 0 KB
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<horses.h>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<setprecision(20)
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1e9+7;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
//llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
//hourses
//セグ木
//doubleでも足りないのでlogを累積和する
//すると、「セグメントのx」、「セグメントのy」、があるので更新する

int n;
static double segx[1048576];
static double segy[1048576];
static llint modx[1048576];
static llint mody[1048576];
vector<llint>mtoy;
int init(int N,vector<int>X,vector<int>Y){
	n=N;
	mtoy.res(N);
	int i;
	for(i=0;i<n;i++){mtoy[i]=Y[i];}
	for(i=(1<<19);i<(1<<19)+N;i++){
		segx[i]=log(X[i-(1<<19)]);
		segy[i]=log(X[i-(1<<19)])+log(Y[i-(1<<19)]);
		modx[i]=X[i-(1<<19)];
		mody[i]=(((llint)Y[i-(1<<19)])*X[i-(1<<19)])%mod;
	}
	for(i=(1<<19)+N;i<(1<<20);i++){segx[i]=-big;segy[i]=-big;mody[i]=0;modx[i]=0;}
	for(i=(1<<19)-1;i>0;i--){
		segx[i]=segx[i+i]+segx[i+i+1];
		modx[i]=(modx[i+i]*modx[i+i+1])%mod;
		if(segy[i+i]>segx[i+i]+segy[i+i+1]){
			segy[i]=segy[i+i];
			mody[i]=mody[i+i];
		}else{
			segy[i]=segx[i+i]+segy[i+i+1];
			mody[i]=(modx[i+i]*mody[i+i+1])%mod;
		}
	}
	return mody[1];
}
int updateX(int pos,int val){
	pos+=(1<<19);
	segy[pos]=log(mtoy[pos-(1<<19)])+log(val);
	segx[pos]=log(val);
	mody[pos]=(mtoy[pos-(1<<19)]*val)%mod;
	modx[pos]=val;
	pos/=2;
	while(pos>0){
		segx[pos]=segx[pos+pos]+segx[pos+pos+1];
		modx[pos]=(modx[pos+pos]*modx[pos+pos+1])%mod;
		if(segy[pos+pos]>segx[pos+pos]+segy[pos+pos+1]){
			segy[pos]=segy[pos+pos];
			mody[pos]=mody[pos+pos];
		}else{
			segy[pos]=segx[pos+pos]+segy[pos+pos+1];
			mody[pos]=(modx[pos+pos]*mody[pos+pos+1])%mod;
		}
		pos/=2;
	}
	return mody[1];
}
int updateY(int pos,int val){
	pos+=(1<<19);
	segy[pos]=segx[pos]+log(val);
	mody[pos]=(modx[pos]*val)%mod;
	mtoy[pos-(1<<19)]=val;
	pos/=2;
	
	while(pos>0){
		segx[pos]=segx[pos+pos]+segx[pos+pos+1];
		modx[pos]=(modx[pos+pos]*modx[pos+pos+1])%mod;
		if(segy[pos+pos]>segx[pos+pos]+segy[pos+pos+1]){
			segy[pos]=segy[pos+pos];
			mody[pos]=mody[pos+pos];
		}else{
			segy[pos]=segx[pos+pos]+segy[pos+pos+1];
			mody[pos]=(modx[pos+pos]*mody[pos+pos+1])%mod;
		}
		pos/=2;
	}
	return mody[1];
}

Compilation message

horses.cpp: In function 'int init(int, std::vector<int>, std::vector<int>)':
horses.cpp:87:15: warning: conversion to 'int' from 'llint {aka long long int}' may alter its value [-Wconversion]
  return mody[1];
         ~~~~~~^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:108:15: warning: conversion to 'int' from 'llint {aka long long int}' may alter its value [-Wconversion]
  return mody[1];
         ~~~~~~^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:129:15: warning: conversion to 'int' from 'llint {aka long long int}' may alter its value [-Wconversion]
  return mody[1];
         ~~~~~~^
/tmp/ccBsypHd.o: In function `main':
grader.c:(.text.startup+0x2db): undefined reference to `init(int, int*, int*)'
collect2: error: ld returned 1 exit status