#include "horses.h"
#include<bits/stdc++.h>
#include<iostream>
#include<stdlib.h>
#include<cmath>
#include <algorithm>
#include<numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define trav(a,x) for (auto& a: x)
#define fr(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>=(b); i+=(s))
#define mp make_pair
#define pb push_back
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define in insert
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define out(x) cout<<x<<'\n'
int dx[4] = { -1, 0, 1, 0 };
int dy[4] = { 0, 1, 0, -1 };
int dx8[8]={0,0,-1,1,-1,1,-1,1};
int dy8[8]={-1,1,0,0,-1,1,1,-1};
char buf[1<<23],*p1=buf,*p2=buf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
inline int rd()
{
int s=0;
char ch=getchar(),last;
while(ch<'0'||ch>'9') last=ch,ch=getchar();
while(ch>='0'&&ch<='9') s=(s<<1)+(s<<3)+(ch^48),ch=getchar();
return last=='-'?-s:s;
}
int num[100];
inline void rt(int x)
{
if(x<0) putchar('-'),x=-x;;
int len=0;
do num[len++]=x%10;while(x/=10);
while(len--) putchar(num[len]+'0');
}
int n;
vector<int> x,y;
void solve(){
vi pre(n);
pre[0]=x[0];
FOR(i,1,n) pre[i]=pre[i-1]*x[i];
int ans=0;
FOR(i,0,n) ans=max(ans,y[i]*pre[i]);
return ans;
}
int init(int N, int X[], int Y[]) {
n=N;
x.resize(n);y.resize(n);
FOR(i,0,n) x[i]=X[i];
FOR(i,0,n) 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();
}
Compilation message
horses.cpp: In function 'void solve()':
horses.cpp:61:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
61 | return ans;
| ^~~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:68:17: error: void value not ignored as it ought to be
68 | return solve();
| ~~~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:72:14: error: void value not ignored as it ought to be
72 | return solve();
| ~~~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:77:14: error: void value not ignored as it ought to be
77 | return solve();
| ~~~~~^~