제출 #1307781

#제출 시각아이디문제언어결과실행 시간메모리
1307781lufychop말 (IOI15_horses)C++20
34 / 100
1595 ms12232 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; long long n; long long mod=1e9+7; vector<long long> x,y; int solve() { int I_max=0; long long tmp=1,ans=1; for(int i=1;i<n;i++) { if(tmp*x[i]>1e9) { I_max=i; tmp=1; } else if(tmp*x[i]*y[i]>1e9) { I_max=i; tmp=1; } else if(tmp*x[i]>y[I_max]) { I_max=i; tmp=1; } else if(tmp*x[i]*y[i]>y[I_max]) { I_max=i; tmp=1; } else { tmp=tmp*x[i]; } } for(int i=0;i<=I_max;i++) { ans=ans*x[i]; ans=ans%mod; } ans=ans*y[I_max]; ans=ans%mod; return ans; } int init(int N, int X[], int Y[]) { n=N; for(int i=0;i<n;i++) { x.push_back(X[i]); y.push_back(Y[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(); }
#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...