# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
869912 |
2023-11-06T09:33:26 Z |
qin |
Horses (IOI15_horses) |
C++17 |
|
1500 ms |
16000 KB |
#ifdef LOCAL
#else
#include "horses.h"
#endif
#include <bits/stdc++.h>
#define fi first
#define se second
#define ssize(x) int(x.size())
#define pn printf("\n")
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef double db;
int inf = 2e09; ll infll = 2e18; ll mod = 1e09+7;
vector<ll> X, Y; // UWAGA - GLOBALNIE ZADEKLAROWANE
int update(){
int n = ssize(X);
int opt = 0; ll mul = 1; bool overflow = 0; db tmp;
for(int i = 1; i < n; ++i){
mul *= X[i];
if(mul >= mod) overflow = 1, mul %= mod;
if(overflow) opt = i, mul = 1, overflow = 0;
else{
tmp = db(Y[opt])/db(Y[i]);
if(db(mul) >= tmp) opt = i, mul = 1, overflow = 0;
}
}
ll result = Y[opt];
for(int i = 0; i <= opt; ++i) result = result * X[i] % mod;
return int(result);
}
int updateX(int i, int val){ X[i] = val; return update(); }
int updateY(int i, int val){ Y[i] = val; return update(); }
int init(int n, int x[], int y[]){
X.resize(n), Y.resize(n);
for(int i = 0; i < n; ++i) X[i] = x[i], Y[i] = y[i];
return update();
}
#ifdef LOCAL
int main(){
int T = 1;
for(++T; --T; ){
int n = 3, x[3] = {2, 1, 3}, y[3] = {3, 2, 1};
printf("%d\n", init(n, x, y));
}
return 0;
}
#endif
# |
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 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
14 ms |
348 KB |
Output is correct |
24 |
Correct |
14 ms |
348 KB |
Output is correct |
25 |
Correct |
18 ms |
500 KB |
Output is correct |
26 |
Correct |
18 ms |
348 KB |
Output is correct |
27 |
Correct |
13 ms |
348 KB |
Output is correct |
28 |
Correct |
14 ms |
348 KB |
Output is correct |
29 |
Correct |
14 ms |
348 KB |
Output is correct |
30 |
Correct |
16 ms |
452 KB |
Output is correct |
31 |
Correct |
10 ms |
448 KB |
Output is correct |
32 |
Correct |
12 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1539 ms |
12120 KB |
Time limit exceeded |
2 |
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 |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
600 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
14 ms |
348 KB |
Output is correct |
24 |
Correct |
14 ms |
348 KB |
Output is correct |
25 |
Correct |
18 ms |
500 KB |
Output is correct |
26 |
Correct |
18 ms |
348 KB |
Output is correct |
27 |
Correct |
13 ms |
348 KB |
Output is correct |
28 |
Correct |
14 ms |
344 KB |
Output is correct |
29 |
Correct |
14 ms |
756 KB |
Output is correct |
30 |
Correct |
16 ms |
348 KB |
Output is correct |
31 |
Correct |
10 ms |
480 KB |
Output is correct |
32 |
Correct |
12 ms |
348 KB |
Output is correct |
33 |
Execution timed out |
1555 ms |
16000 KB |
Time limit exceeded |
34 |
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 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
364 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
600 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
14 ms |
344 KB |
Output is correct |
24 |
Correct |
14 ms |
348 KB |
Output is correct |
25 |
Correct |
18 ms |
496 KB |
Output is correct |
26 |
Correct |
18 ms |
348 KB |
Output is correct |
27 |
Correct |
13 ms |
348 KB |
Output is correct |
28 |
Correct |
14 ms |
472 KB |
Output is correct |
29 |
Correct |
14 ms |
348 KB |
Output is correct |
30 |
Correct |
16 ms |
488 KB |
Output is correct |
31 |
Correct |
11 ms |
480 KB |
Output is correct |
32 |
Correct |
13 ms |
348 KB |
Output is correct |
33 |
Execution timed out |
1555 ms |
14172 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |