제출 #512546

#제출 시각아이디문제언어결과실행 시간메모리
512546AdamGSHorses (IOI15_horses)C++17
34 / 100
1593 ms15972 KiB
#include "horses.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() const int LIM=5e5+7; const ll MOD=1e9+7; ll X[LIM], Y[LIM], n; ll solve() { ll p=1, k=n; while(p<MOD && k>0) { --k; p*=X[k]; } if(p>=MOD) ++k; p=1; ll ans=1, x=1; if(k) ans=Y[k-1]; rep(i, k) x=(x*X[i])%MOD; while(k<n) { p*=X[k]; ans=max(ans, p*Y[k]); ++k; } ans%=MOD; ans=(ans*x)%MOD; return ans; } int init(int D, int A[], int B[]) { n=D; rep(i, n) { X[i]=A[i]; Y[i]=B[i]; } 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 init(int, int*, int*)':
horses.cpp:40:14: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   40 |  return solve();
      |         ~~~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:45:14: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   45 |  return solve();
      |         ~~~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:50:14: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   50 |  return solve();
      |         ~~~~~^~
#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...