Submission #251343

#TimeUsernameProblemLanguageResultExecution timeMemory
251343DavidDamianHorses (IOI15_horses)C++11
0 / 100
1584 ms14412 KiB
#include "horses.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define mod 1000000007 int Y[500005]; int X[500005]; ll product[500005]; int n; int init(int N, int y[], int x[]) { n=N; for(int i=0;i<n;i++){ X[i]=x[i]; Y[i]=y[i]; } ll maximum=0; product[0]=X[0]; maximum=X[0]*Y[0]; for(int i=1;i<n;i++){ product[i]=product[i-1]*X[i]; maximum=max(maximum,(ll)product[i]*(ll)Y[i]); } return (int)maximum%mod; } int updateX(int pos, int val) { ll maximum=0; X[pos]=val; product[0]=X[0]; maximum=X[0]*Y[0]; for(int i=1;i<n;i++){ product[i]=product[i-1]*X[i]; maximum=max(maximum,(ll)product[i]*(ll)Y[i]); } return (int)maximum%mod; } int updateY(int pos, int val) { ll maximum=0; Y[pos]=val; product[0]=X[0]; maximum=X[0]*Y[0]; for(int i=1;i<n;i++){ product[i]=product[i-1]*X[i]; maximum=max(maximum,(ll)product[i]*(ll)Y[i]); } return (int)maximum%mod; }
#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...