Submission #1233607

#TimeUsernameProblemLanguageResultExecution timeMemory
123360712baaterHorses (IOI15_horses)C++20
17 / 100
1596 ms8264 KiB
#include "horses.h"
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

const ll MOD = 1E9 + 7;
const int MAXN = 500050;
int n;
vector<int> x(MAXN);
vector<int> y(MAXN);

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


int init(int N, int X[], int Y[]) {
    n = N;
    for (int i = 0; i < N; i++) {
        x[i] = X[i];
        y[i] = 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...