# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
801960 | jlallas384 | Horses (IOI15_horses) | C++17 | 1565 ms | 12148 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;
using ll = long long;
const int mod = 1e9 + 7;
vector<int> x, y;
int n;
int solve(){
int ans = 0;
int hv = 1;
for(int i = 0; i < n; i++){
hv = (ll) hv * x[i] % mod;
if(y[i] > y[i + 1]){
ans = (ans + ll(hv - 1 + mod) % mod * y[i]) % mod;
hv = 1;
}
}
return ans;
}
int init(int N, int X[], int Y[]) {
n = N;
x.resize(n), y.resize(n);
for(int i = 0; i < n; i++){
x[i] = X[i];
y[i] = Y[i];
}
y.push_back(-1);
return solve();
}
int updateX(int pos, int val) {
x[pos] = val;
return solve();
}
int updateY(int pos, int val) {
y[pos] = val;
return solve();
}
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... |