#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
int read(){int x;scanf("%d",&x);return x;}
void print(int x){printf("%d\n",x);}
const int mod=1000000007;
int n;
struct node
{
int ans,mul;
double lgmul,lgans;
}seg[500005*4];
int x[500005],y[500005];
void upd(int id)
{
seg[id].mul=seg[id*2].mul*seg[id*2+1].mul%mod;
seg[id].lgmul=seg[id*2].lgmul+seg[id*2+1].lgmul;
double fi=seg[id*2].lgans;
double se=seg[id*2].lgmul+seg[id*2+1].lgans;
if(fi>se)
{
seg[id].ans=seg[id*2].ans;
seg[id].lgans=seg[id*2].lgans;
}
else
{
seg[id].ans=seg[id*2].mul*seg[id*2+1].ans%mod;
seg[id].lgans=seg[id*2].lgmul+seg[id*2+1].lgans;
}
}
void build(int id,int l,int r)
{
if(l==r)
{
seg[id].ans=x[l]*y[l]%mod;
seg[id].mul=x[l];
seg[id].lgmul=log(x[l]);
seg[id].lgans=log(x[l])+log(y[l]);
return;
}
int mid=(l+r)/2;
build(id*2,l,mid);build(id*2+1,mid+1,r);
upd(id);
}
void change(int id,int l,int r,int pos,int val,int ty)
{
if(l==r)
{
if(ty==0){x[l]=val;}
else{y[l]=val;}
seg[id].ans=x[l]*y[l]%mod;
seg[id].mul=x[l];
seg[id].lgmul=log(x[l]);
seg[id].lgans=log(x[l])+log(y[l]);
return;
}
int mid=(l+r)/2;
if(pos<=mid){change(id*2,l,mid,pos,val,ty);}
else{change(id*2+1,mid+1,r,pos,val,ty);}
upd(id);
}
int init(int N,vector<int> X,vector<int> Y){n=N;rep(i,n){x[i+1]=X[i];y[i+1]=Y[i];}build(1,1,n);return seg[1].ans;}
int updateX(int pos,int val){pos++;change(1,1,n,pos,val,0);return seg[1].ans;}
int updateY(int pos,int val){pos++;change(1,1,n,pos,val,1);return seg[1].ans;}
Compilation message
horses.cpp: In function 'int read()':
horses.cpp:7:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
7 | int read(){int x;scanf("%d",&x);return x;}
| ~~~~~^~~~~~~~~
/usr/bin/ld: /tmp/ccYhEK1h.o: in function `main':
grader.c:(.text.startup+0xaa): undefined reference to `init(int, int*, int*)'
collect2: error: ld returned 1 exit status