Submission #137315

#TimeUsernameProblemLanguageResultExecution timeMemory
137315eohomegrownappsHorses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
int md = 1000000007;
vector<int> x;
vector<int> y;
int n;
int init(int N, int X[], int Y[]) {
	n=N;
	x.resize(n);
	y.resize(n);
	for (int i = 0; i<n; i++){
		x[i]=X[i];
		y[i]=Y[i];
	}
	return query();
}

int query(){
	int mx = 1;
	int current = 1;
	for (int i = 0; i<n; i++){
		current*=x[i];
		current%=md;
		mx=max(mx,(current*y[i])%md);
	}
	return mx;
}

int updateX(int pos, int val) {
	x[pos]=val;
	return query();
}

int updateY(int pos, int val) {
	y[pos]=val;
	return query();
}

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:16:9: error: 'query' was not declared in this scope
  return query();
         ^~~~~