#include "horses.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <functional>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
vector<int> x;
vector<int> y;
int n;
double logp(int i){
return log2(i);
}
int expp(double i){
return round(pow(2,a));
}
const double MOD = logp(1e9+7);
int calc(){
double horses = logp(1);
double p = 0;
for(int i = 0;i<n;i++){
horses += logp(x[i]);
p = max(p,horses+logp(y[i]));
}
return expp(p);
}
int init(int N, int X[], int Y[]) {
n = N;
x.assign(N,0);
y.assign(N,0);
for(int i = 0;i<n;i++){
x[i] = X[i];
y[i] = Y[i];
}
return calc();
}
int updateX(int pos, int val) {
x[pos] = val;
return calc();
}
int updateY(int pos, int val) {
y[pos] = val;
return calc();
}
Compilation message
horses.cpp: In function 'int expp(double)':
horses.cpp:31:21: error: 'a' was not declared in this scope
31 | return round(pow(2,a));
| ^
horses.cpp:30:17: warning: unused parameter 'i' [-Wunused-parameter]
30 | int expp(double i){
| ~~~~~~~^