Submission #206013

#TimeUsernameProblemLanguageResultExecution timeMemory
206013SegtreeHorses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
#include"horses.h" #include<iostream> #include<algorithm> #include<vector> #include<queue> using namespace std; typedef long long ll; #define chmin(a,b) a=min(a,b) #define chmax(a,b) a=max(a,b) #define all(x) x,begin(),x.end() #define rep(i,n) for(int i=0;i<n;i++) #define mod 1000000007 #define mad(a,b) a=(a+b)%mod int N,X[2010],Y[2010]; int solve(){ ll p=N-1,rui=1; for(int i=N-1;i>=0;i--){ rui*=X[i]; if(rui>1e9)break; p=i; } ll ans=1; rui=1; for(int i=p;i<N;i++){ rui*=X[i]; chmax(ans,rui*Y[i]); } ans%=mod; rep(i,p)ans=ans*X[i]%mod; return ans; } void init(int n,int x[],int y[]){ N=n; rep(i,N)X[i]=x[i],Y[i]=y[i]; } int updateX(int pos,int val){ X[pos]=val; return solve(); } int updateY(int pos,int val){ Y[pos]=val; return solve(); }/* int main(){ cin>>N; rep(i,N)cin>>X[i]; rep(i,N)cin>>Y[i]; while(1){ string type; ll pos,val; cin>>type>>pos>>val; if(type=="X")cout<<updateX(pos,val)<<endl; if(type=="Y")cout<<updateY(pos,val)<<endl; } }*/

Compilation message (stderr)

horses.cpp: In function 'int solve()':
horses.cpp:19:10: warning: conversion to 'double' from 'll {aka long long int}' may alter its value [-Wconversion]
   if(rui>1e9)break;
          ^~~
horses.cpp:24:12: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  for(int i=p;i<N;i++){
            ^
horses.cpp:30:9: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return ans;
         ^~~
horses.cpp: In function 'void init(int, int*, int*)':
horses.cpp:32:6: error: ambiguating new declaration of 'void init(int, int*, int*)'
 void init(int n,int x[],int y[]){
      ^~~~
In file included from horses.cpp:1:0:
horses.h:4:5: note: old declaration 'int init(int, int*, int*)'
 int init(int N, int X[], int Y[]);
     ^~~~