제출 #68967

#제출 시각아이디문제언어결과실행 시간메모리
68967theknife2001말 (IOI15_horses)C++17
0 / 100
1578 ms16220 KiB
#include "horses.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; const int N=5e5+55; long long x[N]; long long y[N]; long long s[N]; int n; int m=1e9+7; int solve() { int i=n-1; long long ret=0; long long temp=1; while(i) { s[i]=x[i]*s[i+1]; if(s[i]>1000000000) break; i--; } i++; int bestpos=n-1; for(;i<n;i++) { temp*=x[i]; if(y[i]*temp>ret) { ret=y[i]*temp; bestpos=i; } } ret=1; for(int i=0;i<=bestpos;i++) { ret*=x[i]; ret%=m; } ret*=y[bestpos]; ret%=m; return ret; } int init(int N, int X[], int Y[]) { n=N; for(int i=0;i<N;i++) { s[i]=1; x[i]=X[i]; y[i]=Y[i]; } s[n]=1; s[n+1]=1; return solve(); } int updateX(int pos, int val) { x[pos]=val; return solve(); } int updateY(int pos, int val) { y[pos]=val; return solve(); }

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

horses.cpp: In function 'int solve()':
horses.cpp:37:13: warning: declaration of 'i' shadows a previous local [-Wshadow]
     for(int i=0;i<=bestpos;i++)
             ^
horses.cpp:15:6: note: shadowed declaration is here
  int i=n-1;
      ^
horses.cpp:44:12: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return ret;
            ^~~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:47:33: warning: declaration of 'N' shadows a global declaration [-Wshadow]
 int init(int N, int X[], int Y[])
                                 ^
horses.cpp:6:11: note: shadowed declaration is here
 const int N=5e5+55;
           ^
#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...