# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
348798 | Sprdalo | Horses (IOI15_horses) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;
const int mod = 1e9 + 7;
void f(ll& x){
if (x >= mod)
x %= mod;
}
ll g(ll x){
f(x);
return x;
}
vi x, y;
ll init(int n, int X[], int Y[]){
x = vi(n); y = vi(n);
for (int i = 0; i < n; ++i){
x[i] = X[i];
y[i] = Y[i];
}
ll s = 1, sol = 0;
for (int i = 0; i < n; ++i){
sol = max(sol, g(s*y[i]));
s *= x[i];
f(s);
}
return sol;
}
/*
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cerr.tie(nullptr);
int n;
cin >> n;
int x[n], y[n];
for (int i = 0; i < n; ++i)
cin >> x[i] >> y[i];
cout << init(n,x,y) << '\n';
}*/