Submission #109096

#TimeUsernameProblemLanguageResultExecution timeMemory
109096GaruHorses (IOI15_horses)C++14
0 / 100
18 ms9856 KiB
#include <bits/stdc++.h>

using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
typedef long long ll;
int x[MAXN] , y[MAXN];
int n;
int updateX(int pos,int val)
{
x[pos] = val;
ll ans = x[0] * y[0];
ans%=MOD;
ll profit = 0;
ll horses = x[0];

for(int i = 1 ; i < n ; i++)
{
	horses = (horses % MOD * x[i] % MOD) % MOD;
	horses%=MOD;
	profit = (horses % MOD * y[i] % MOD) % MOD;
	ans = max(ans , profit);
}

return (int)ans;


}

int updateY(int pos,int val)
{

y[pos] = val;

ll ans = (y[0] * x[0]);
ans%=MOD;
ll profit = 0;
ll horses = x[0];

for(int i = 1 ; i < n ; i++)
{
	horses = (horses % MOD * x[i] % MOD) % MOD;
	horses%=MOD;
	profit = (horses % MOD * y[i] % MOD) % MOD;
	ans = max(ans , profit);
}

return (int)ans;

}

int init(int N , int X[] , int Y[])
{
n = N;
ll ans = x[0] * y[0];
ans%=MOD;
ll profit = 0;
ll horses = x[0];
for(int  i = 0 ; i < n ; i++)
 {
     x[i] = X[i];
     y[i] = Y[i];
 }
for(int i = 1 ; i < n ; i++)
{
	horses = (horses % MOD * x[i] % MOD) % MOD;
	horses%=MOD;
	profit = (horses % MOD * y[i] % MOD) % MOD;
	ans = max(ans , profit);
}

return (int)ans;

}
 
#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...