Submission #738615

#TimeUsernameProblemLanguageResultExecution timeMemory
738615fractlpacaHorses (IOI15_horses)C++17
0 / 100
1537 ms10508 KiB
#include "horses.h"
#include <vector>
#include <algorithm>

#define v vector

#define MOD 1000000007

using namespace std;

v<int> xs;
v<int> ys;
int n;

int init(int N, int X[], int Y[]) {
	n = N;
	for (int i=0; i<n; i++) {
		xs.push_back(X[i]);
		ys.push_back(Y[i]);
	}
	return 0;
}

// Subtask 1

int solve() {
	int ma = 0;
	int pop = 1;
	for(int i=0; i<n; i++) {
		pop*=xs[i];
		ma = max(ma, pop*ys[i]);
	}
	return ma%MOD;
}

int updateX(int pos, int val) {
	xs[pos] = val;
	return solve();
}

int updateY(int pos, int val) {
	ys[pos] = val;
	return solve();
}


// Subtask 2

// int updateX(int pos, int val) {	
// 	return 0;
// }

// int updateY(int pos, int val) {
// 	return 0;
// }
#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...