Submission #1191988

#TimeUsernameProblemLanguageResultExecution timeMemory
1191988nagorn_ph말 (IOI15_horses)C++20
17 / 100
7 ms4436 KiB
#include <bits/stdc++.h>
#include "horses.h"

using namespace std;

const int mod = 1e9 + 7;

int nn;
vector <int> a(1005), b(1005);

int init(int n, int x[], int y[]) {
	nn = n;
	int ans = 1, h = 1;
	for (int i = 0; i < n; i++) {
		a[i] = x[i];
		b[i] = y[i];
		h *= x[i];
		ans = max(ans, h * y[i]);
	}
	ans %= mod;
	return ans;
}

int updateX(int pos, int val) {	
	a[pos] = val;
	int ans = 1, h = 1;
	for (int i = 0; i < nn; i++) {
		h *= a[i];
		ans = max(ans, h * b[i]);
	}
	ans %= mod;
	return ans;
}

int updateY(int pos, int val) {
	b[pos] = val;
	int ans = 1, h = 1;
	for (int i = 0; i < nn; i++) {
		h *= a[i];
		ans = max(ans, h * b[i]);
	}
	ans %= mod;
	return 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...