# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
597102 | PiejanVDC | Horses (IOI15_horses) | C++17 | 1584 ms | 16192 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;
vector<long long>x,y;
long long mod = (long long)1000000007;
int calc() {
int n = (int)x.size();
int last = -1;
bool ok = 1;
while(ok) {
ok = 0;
long long c = 1;
for(int i = last+1 ; i < n ; i++) {
c *= x[i];
c = min(c, (long long)1e9+5);
if(c * y[i] > (last == -1 ? 0 : y[last])) {
last = i;
ok = 1;
break;
}
}
}
long long C = 1;
for(int i = 0 ; i <= last ; i++)
C *= x[i], C %= mod;
return int((C * y[last])%mod);
}
int init(int n, int X[], int Y[]) {
for(int i = 0 ; i < n ; i++)
x.push_back(X[i]), y.push_back(Y[i]);
return calc();
}
int updateX(int p, int val) {
int n = (int)x.size();
x[p] = val;
return calc();
}
int updateY(int p, int val) {
int n = (int)x.size();
y[p] = val;
return calc();
}
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... |