Submission #416593

#TimeUsernameProblemLanguageResultExecution timeMemory
416593victoriadHorses (IOI15_horses)C++14
0 / 100
19 ms16168 KiB
#include "horses.h" #include "vector" #include "cmath" #include "algorithm" #include "utility" using namespace std; using namespace std; vector<int>lista1; vector<int>lista2; vector<int>lista3; int m; int init(int N, int X[], int Y[]) { lista1.resize(N); lista2.resize(N); for(int i=0;i<N;i++)lista2[i]=Y[i]; for(int i=0;i<N;i++)lista3[i]=X[i]; int a=0; int y=0; int mod=1e9+7; int j=1; int r2=1; for(int i=0;i<N;i++){ r2*=X[i]; r2%=(mod); lista1[i]=r2; j=max(j,r2*Y[i]); } j%=mod; m=j; return j; } int updateX(int pos, int val) { int mod=1e9+7; int a=lista3[pos]; lista3[pos]=val; for(int i=pos;i<lista3.size();i++){ lista1[i]/=a; lista1[i]*=val; if(lista2[i]*lista1[i]>m){ m=lista2[i]*lista1[i]; m%=mod; } } return m; } int updateY(int pos, int val) { int mod=1e9+7; if(lista1[pos]*val>m){ m=lista1[pos]*val%mod; } return m; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:18:6: warning: unused variable 'a' [-Wunused-variable]
   18 |  int a=0;
      |      ^
horses.cpp:19:6: warning: unused variable 'y' [-Wunused-variable]
   19 |  int y=0;
      |      ^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:38:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |  for(int i=pos;i<lista3.size();i++){
      |                ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...