# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
620642 | mdn2002 | Horses (IOI15_horses) | C++14 | 22 ms | 12188 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;
long long n , m , mod = 1e9 + 7 , x [1003] , y [1003];
long long get ( )
{
long long bst = 0 , mul = 1;
for ( int i = 1 ; i < n ; i ++ )
{
mul *= x [i];
if ( mul > y [bst] )
{
mul = 1;
bst = i;
continue;
}
long long almul = mul * y [i];
if ( almul > y [bst] )
{
mul = 1;
bst = i;
}
}
long long ans = 1;
for ( int i = 0 ; i <= bst ; i ++ ) ans = ( ans * x [i] ) % mod;
ans = ( ans * y [bst] ) % mod;
return ans;
}
int init(int N, int X[], int Y[]) {
n = N;
for ( int i = 0 ; i < n ; i ++ ) x [i] = X [i];
for ( int i = 0 ; i < n ; i ++ ) y [i] = Y [i];
return get ();
}
int updateX(int pos, int val) {
x [pos] = val;
return get ();
}
int updateY(int pos, int val) {
y [pos] = val;
return get ();
}
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... |