| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 137344 | eohomegrownapps | Horses (IOI15_horses) | C++14 | 1561 ms | 13504 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 "horses.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll md = 1000000007;
vector<ll> x;
vector<ll> y;
ll n;
vector<ll> mult(vector<ll> a, ll b){
ll carry = 0;
ll mult = b;
for (ll i = 0; i<a.size(); i++){
a[i]*=mult;
a[i]+=carry;
carry=a[i]/md;
a[i]%=md;
}
if (carry>0){
a.push_back(carry);
}
return a;
}
bool geq(vector<ll> &a, vector<ll> &b){
if (a.size()>b.size()){
return true;
} else if (a.size()<b.size()){
return false;
} else {
for (int i = a.size()-1; i>=0; i--){
if (a[i]<b[i]){
return false;
}
}
}
return true;
}
int query(){
vector<ll> mx=vector<ll>(1,1);
vector<ll> current=vector<ll>(1,1);
for (ll i = 0; i<n; i++){
current=mult(current,x[i]);
auto ans = mult(current,y[i]);
if (geq(ans,mx)){
mx=ans;
}
}
return mx[0];
}
int init(int N, int X[], int Y[]) {
n=N;
x.resize(n);
y.resize(n);
for (ll i = 0; i<n; i++){
x[i]=X[i];
y[i]=Y[i];
}
return query();
}
int updateX(int pos, int val) {
x[pos]=val;
return query();
}
int updateY(int pos, int val) {
y[pos]=val;
return query();
}
Compilation message (stderr)
| # | 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... | ||||
