#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 mp make_pair
#define pb push_back
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#include "horses.h"
const int MAX=1e5,MOD=1e9+7;
int n, x[MAX], y[MAX];
int solve(){
ll h = 1, l = 0, p = 1, resp = 0;
for(int i = 1; i <= n; i++) {
h *= x[i];
p = (p * x[i] % MOD);
long double aux = y[i] * h;
if(aux > (long double) l){
resp = (p * y[i]) % MOD;
h = 1, l = y[i];
}
}
resp %= MOD;
return (int) resp;
}
int init(int _n, int _x[], int _y[]){
n = _n;
for(int i = 1; i <= n; i++)
x[i] = _x[i - 1], y[i] = _y[i - 1];
return solve();
}
int updateX(int pos, int val){
x[pos + 1] = val;
return solve();
}
int updateY(int pos, int val){
y[pos + 1] = val;
return solve();
}
int main() {
int N;cin>>N;
int X[N],Y[N];
FOR(i,0,N) cin>>X[i];
FOR(i,0,N) cin>>Y[i];
cout<<init(N,X,Y)<<'\n';
int M; cin>>M;
for (int i = 0; i < M; i++) {
int type,pos,val;
cin>>type>>pos>>val;
if (type == 1) {
cout<<updateX(pos,val)<<'\n';
} else if (type == 2) {
cout<<updateY(pos,val)<<'\n';
}
}
return 0;
}
Compilation message
/usr/bin/ld: /tmp/cc47uLyr.o: in function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccFit39p.o:horses.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status