Submission #921290

# Submission time Handle Problem Language Result Execution time Memory
921290 2024-02-03T16:22:48 Z ByeWorld Horses (IOI15_horses) C++14
34 / 100
41 ms 37644 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 2 ms 8540 KB Output is correct
2 Correct 1 ms 8536 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 8652 KB Output is correct
6 Correct 1 ms 8536 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 8536 KB Output is correct
10 Correct 1 ms 8540 KB Output is correct
11 Correct 1 ms 8652 KB Output is correct
12 Correct 1 ms 8536 KB Output is correct
13 Correct 1 ms 8540 KB Output is correct
14 Correct 1 ms 8540 KB Output is correct
15 Correct 1 ms 8540 KB Output is correct
16 Correct 2 ms 8692 KB Output is correct
17 Correct 1 ms 8540 KB Output is correct
18 Correct 1 ms 8540 KB Output is correct
19 Correct 1 ms 8540 KB Output is correct
20 Correct 2 ms 8540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 8540 KB Output is correct
2 Correct 1 ms 8648 KB Output is correct
3 Correct 2 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 2 ms 8540 KB Output is correct
11 Correct 1 ms 8540 KB Output is correct
12 Correct 1 ms 8540 KB Output is correct
13 Correct 1 ms 8540 KB Output is correct
14 Correct 1 ms 8644 KB Output is correct
15 Correct 1 ms 8540 KB Output is correct
16 Correct 1 ms 8540 KB Output is correct
17 Correct 1 ms 8540 KB Output is correct
18 Correct 1 ms 8540 KB Output is correct
19 Correct 1 ms 8540 KB Output is correct
20 Correct 1 ms 8540 KB Output is correct
21 Correct 1 ms 8540 KB Output is correct
22 Correct 1 ms 8792 KB Output is correct
23 Correct 6 ms 8540 KB Output is correct
24 Correct 6 ms 8704 KB Output is correct
25 Correct 6 ms 8540 KB Output is correct
26 Correct 6 ms 8648 KB Output is correct
27 Correct 6 ms 8540 KB Output is correct
28 Correct 6 ms 8540 KB Output is correct
29 Correct 6 ms 8540 KB Output is correct
30 Correct 6 ms 8540 KB Output is correct
31 Correct 6 ms 8540 KB Output is correct
32 Correct 6 ms 8540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 37 ms 33876 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 8540 KB Output is correct
2 Correct 2 ms 8540 KB Output is correct
3 Correct 2 ms 8540 KB Output is correct
4 Correct 1 ms 8792 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8540 KB Output is correct
7 Correct 2 ms 8540 KB Output is correct
8 Correct 1 ms 8536 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 Correct 1 ms 8540 KB Output is correct
13 Correct 1 ms 8540 KB Output is correct
14 Correct 1 ms 8540 KB Output is correct
15 Correct 1 ms 8540 KB Output is correct
16 Correct 1 ms 8536 KB Output is correct
17 Correct 1 ms 8536 KB Output is correct
18 Correct 1 ms 8540 KB Output is correct
19 Correct 2 ms 8540 KB Output is correct
20 Correct 1 ms 8540 KB Output is correct
21 Correct 2 ms 8540 KB Output is correct
22 Correct 1 ms 8540 KB Output is correct
23 Correct 6 ms 8540 KB Output is correct
24 Correct 6 ms 8540 KB Output is correct
25 Correct 6 ms 8540 KB Output is correct
26 Correct 6 ms 8540 KB Output is correct
27 Correct 6 ms 8540 KB Output is correct
28 Correct 6 ms 8540 KB Output is correct
29 Correct 6 ms 8540 KB Output is correct
30 Correct 6 ms 8540 KB Output is correct
31 Correct 8 ms 8540 KB Output is correct
32 Correct 6 ms 8540 KB Output is correct
33 Runtime error 41 ms 37644 KB Execution killed with signal 11
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 8536 KB Output is correct
2 Correct 1 ms 8536 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 8652 KB Output is correct
9 Correct 1 ms 8540 KB Output is correct
10 Correct 1 ms 8536 KB Output is correct
11 Correct 1 ms 8540 KB Output is correct
12 Correct 1 ms 8540 KB Output is correct
13 Correct 1 ms 8540 KB Output is correct
14 Correct 1 ms 8540 KB Output is correct
15 Correct 1 ms 8536 KB Output is correct
16 Correct 2 ms 8540 KB Output is correct
17 Correct 2 ms 8540 KB Output is correct
18 Correct 1 ms 8540 KB Output is correct
19 Correct 1 ms 8536 KB Output is correct
20 Correct 1 ms 8540 KB Output is correct
21 Correct 1 ms 8540 KB Output is correct
22 Correct 1 ms 8540 KB Output is correct
23 Correct 6 ms 8540 KB Output is correct
24 Correct 6 ms 8540 KB Output is correct
25 Correct 6 ms 8560 KB Output is correct
26 Correct 6 ms 8540 KB Output is correct
27 Correct 6 ms 8536 KB Output is correct
28 Correct 6 ms 8540 KB Output is correct
29 Correct 6 ms 8540 KB Output is correct
30 Correct 6 ms 8540 KB Output is correct
31 Correct 6 ms 8536 KB Output is correct
32 Correct 6 ms 8792 KB Output is correct
33 Runtime error 34 ms 35948 KB Execution killed with signal 11
34 Halted 0 ms 0 KB -