#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef tuple <ll,ll,ll> plll;
typedef vector <plll> vplll;
typedef pair <ll,ll> pll;
typedef vector <ll> vll;
typedef vector <pll> vpll;
typedef vector <vector <pll>> vvpll;
typedef vector <vector <ll>> vvll;
typedef vector <bool> vb;
typedef vector <vector <bool>> vvb;
#define loop(i, s, e) for (ll i = (s); i < (e); ++i)
#define loopr(i, e, s) for (ll i = (e)-1; i >= (s); --i)
#define all(a) a.begin(), a.end()
const ll inf = 1e9 + 7;
vector<double> x,y;
vll X,Y;
ll n;
int init(int N, int X1[], int Y1[]) {
n = N;
x.resize(n), y.resize(n);
X.resize(n), Y.resize(n);
loop(i,0,n) {
x[i] = log2((double)X1[i]);
y[i] = log2((double)Y1[i]);
X[i] = X1[i];
Y[i] = Y1[i];
}
ll hor = 1, ans = 0,idx= 0;
loop(i,0,n) {
hor=(x[i]*hor);
if (ans < y[i]*hor) {
idx = i;
ans = y[i]*hor;
}
}
ll ansi = 1;
loop(i,0, idx+1) ansi = (ansi*X[i])%inf;
ansi= (ansi*Y[idx])%inf;
return ansi;
}
int updateX(int pos, int val) {
x[pos] = log2(val);
X[pos] = val; ll hor = 1, ans = 0,idx= 0;
loop(i,0,n) {
hor=(x[i]*hor);
if (ans < y[i]*hor) {
idx = i;
ans = y[i]*hor;
}
}
ll ansi = 1;
loop(i,0, idx+1) ansi = (ansi*X[i])%inf;
ansi= (ansi*Y[idx])%inf;
return ansi;
}
int updateY(int pos, int val) {
y[pos] = log2(val);
Y[pos] = val;
ll hor = 1, ans = 0,idx= 0;
loop(i,0,n) {
hor=(x[i]*hor);
if (ans < y[i]*hor) {
idx = i;
ans = y[i]*hor;
}
}
ll ansi = 1;
loop(i,0, idx+1) ansi = (ansi*X[i])%inf;
ansi= (ansi*Y[idx])%inf;
return ansi;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |