# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
921284 |
2024-02-03T16:15:42 Z |
ByeWorld |
Horses (IOI15_horses) |
C++14 |
|
32 ms |
33876 KB |
#include "horses.h"
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
using namespace std;
const int MAXN = 2e5+10;
const int MOD = 1e9+7;
typedef pair<int,int> pii;
typedef pair<int,pii> ipii;
ll mul(ll x, ll y){
ll num = (x*y)%MOD;
return num;
}
int n;
ll pr[MAXN], ans[MAXN], x[MAXN], y[MAXN], mx, idx;
ld lx[MAXN], ly[MAXN];
int calc(){
pr[0] = 1, mx = -1, idx = -1;
ld cur = 0, MX = 0;
for(int i=1; i<=n; i++){
pr[i] = mul(pr[i-1], x[i]);
cur += lx[i];
if(MX < cur + ly[i]){
MX = cur + ly[i];
idx = i;
}
}
return (int)mul(pr[idx], y[idx]);
}
int init(int N, int X[], int Y[]) {
n = N;
for(int i=1; i<=n; i++) {
x[i] = X[i-1]; y[i] = Y[i-1];
lx[i] = log2(x[i]); ly[i] = log2(y[i]);
}
return calc();
}
int updateX(int pos, int val) {
x[pos+1] = val; lx[pos+1] = log2(val);
return calc();
}
int updateY(int pos, int val) {
y[pos+1] = val; ly[pos+1] = log2(val);
return calc();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8536 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8540 KB |
Output is correct |
4 |
Correct |
1 ms |
8540 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
1 ms |
8540 KB |
Output is correct |
8 |
Correct |
1 ms |
8540 KB |
Output is correct |
9 |
Correct |
1 ms |
8540 KB |
Output is correct |
10 |
Correct |
1 ms |
8540 KB |
Output is correct |
11 |
Correct |
1 ms |
8540 KB |
Output is correct |
12 |
Incorrect |
1 ms |
8540 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8536 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8540 KB |
Output is correct |
4 |
Correct |
2 ms |
8540 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
1 ms |
8540 KB |
Output is correct |
8 |
Correct |
1 ms |
8540 KB |
Output is correct |
9 |
Correct |
1 ms |
8540 KB |
Output is correct |
10 |
Correct |
1 ms |
8540 KB |
Output is correct |
11 |
Correct |
1 ms |
8540 KB |
Output is correct |
12 |
Incorrect |
1 ms |
8540 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
32 ms |
33876 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8536 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8540 KB |
Output is correct |
4 |
Correct |
1 ms |
8540 KB |
Output is correct |
5 |
Correct |
2 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
1 ms |
8540 KB |
Output is correct |
8 |
Correct |
2 ms |
8656 KB |
Output is correct |
9 |
Correct |
2 ms |
8540 KB |
Output is correct |
10 |
Correct |
1 ms |
8540 KB |
Output is correct |
11 |
Correct |
1 ms |
8536 KB |
Output is correct |
12 |
Incorrect |
1 ms |
8540 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8636 KB |
Output is correct |
3 |
Correct |
1 ms |
8540 KB |
Output is correct |
4 |
Correct |
2 ms |
8652 KB |
Output is correct |
5 |
Correct |
1 ms |
8648 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
1 ms |
8540 KB |
Output is correct |
8 |
Correct |
1 ms |
8536 KB |
Output is correct |
9 |
Correct |
2 ms |
8536 KB |
Output is correct |
10 |
Correct |
2 ms |
8540 KB |
Output is correct |
11 |
Correct |
1 ms |
8540 KB |
Output is correct |
12 |
Incorrect |
1 ms |
8540 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |