# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1017922 |
2024-07-09T11:32:37 Z |
Muhammet |
Horses (IOI15_horses) |
C++17 |
|
28 ms |
34516 KB |
#include <bits/stdc++.h>
#include "horses.h"
using namespace std;
#define ll long long
const ll M = 1e9 + 7;
int n;
vector <int> a1, b1;
int f(){
vector <int> a(1,0), b(1,0), p(n+1,1), mx(n+2,0);
for(auto i : a1) a.push_back(i);
for(auto i : b1) b.push_back(i);
for(int i = 1; i <= n; i++){
p[i] = p[i-1] * a[i];
}
for(int i = n; i >= 1; i--){
mx[i] = max(mx[i+1], p[i] * b[i]);
}
int ind = 1;
int ans = 0, k = 0;
for(int i = 1; i <= n; i++){
if(p[i] * b[i] == mx[ind]){
k = max(k,ans+((p[i] * (b[i])) / p[ind-1]));
if(i == n) b[i]++;
ans += ((p[i] * (b[i]-1)) / p[ind-1]);
ind = i+1;
ans %= M;
k %= M;
}
}
ans = max(ans,k);
ans %= M;
return ans;
}
int init(int N, int X[], int Y[]) {
n = N;
a1.resize(n);
b1.resize(n);
for(int i = 0; i < n; i++){
a1[i] = X[i];
b1[i] = Y[i];
}
return f();
}
int updateX(int pos, int val) {
a1[pos] = val;
return f();
}
int updateY(int pos, int val) {
b1[pos] = val;
return f();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
28 ms |
34516 KB |
Execution killed with signal 8 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
416 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |