제출 #416623

#제출 시각아이디문제언어결과실행 시간메모리
416623victoriad말 (IOI15_horses)C++14
17 / 100
69 ms15004 KiB
#include "horses.h" #include "vector" #include "cmath" #include "algorithm" #include "utility" using namespace std; int mod=1e9+7; vector<int>lista1; vector<int>lista2; vector<int>lista3; vector<double>lista4; int m; double lm; int init(int N, int X[], int Y[]) { lista1.resize(N); lista2.resize(N); lista3.resize(N); lista4.resize(N); for(int i=0;i<N;i++)lista2[i]=Y[i]; for(int i=0;i<N;i++)lista3[i]=X[i]; double j=0; double r2=0; int a=1; int o=0; for(int i=0;i<N;i++){ r2+=log10(X[i]); lista4[i]=r2; lista1[i]=a*X[i]; lista1[i]%=mod; a=lista1[i]; if(r2+log10(Y[i])>j){ j=r2+log10(Y[i]); o=i; } } lm=j; m=lista1[o]%mod; m*=Y[o]; m%=mod; return m; } int updateX(int pos, int val) { double j=lm; double r2=0; int a=1; int o=0; lista3[pos]=val; for(int i=0;i<lista3.size();i++){ r2+=log10(lista3[i]); lista4[i]=r2; lista1[i]=a*lista3[i]; lista1[i]%=mod; a=lista1[i]; if(r2+log10(lista2[i])>j){ j=r2+log10(lista2[i]); o=i; } } lm=j; m=lista1[o]%mod; m*=lista2[o]; m%=mod; return m; } int updateY(int pos, int val) { lista2[pos]=val; if(lista4[pos]+log10(val)>lm){ lm=lista4[pos]+log10(val)-log10(lista2[pos]); m=lista1[pos]%mod; m*=val; m%=mod; } return m; }

컴파일 시 표준 에러 (stderr) 메시지

horses.cpp: In function 'int updateX(int, int)':
horses.cpp:51:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |  for(int i=0;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...