Submission #1185366

#TimeUsernameProblemLanguageResultExecution timeMemory
1185366mahmudow_mahmytHorses (IOI15_horses)C++20
0 / 100
22 ms16200 KiB
#include<bits/stdc++.h>
#include "horses.h"
#define ll long long
#define ff first
#define ss second
#define mxn 500002
#define pb push_back
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using namespace std;
ll n,x[mxn],y[mxn],mod=1e9+7,p[mxn];
ll max_profit(){
	ll mx=0;
	for(int i=0;i<n;i++){
		ll c=(p[i]*y[i])%mod;
		if(c>mx){
			mx=c;
		}
	}
	return mx;
}
int init(int n, int X[], int Y[]){
	for(int i=0;i<n;i++){
		x[i]=X[i];
		y[i]=Y[i];
	}
	p[0]=x[0]%mod;
	for(int i=1;i<n;i++){
		p[i]=p[i-1]*x[i];
		p[i]%=mod;
	}
	return (int) max_profit();
}
int updateX(int pos, int val){
	x[pos]=val%mod;
	return (int) max_profit();
}
int updateY(int pos, int val){
	y[pos]=val%mod;
	return (int) max_profit();
}
#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...