# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82987 | 2018-11-03T13:21:20 Z | arman_ferdous | Horses (IOI15_horses) | C++17 | 1500 ms | 21856 KB |
#include <bits/stdc++.h> #include "horses.h" using namespace std; typedef long long ll; const int N = 5e5+10; const int MOD = 1e9+7; int n; double x[N], y[N]; int init(int N, int X[], int Y[]) { n = N; for(int i = 0; i < n; i++) x[i] = X[i]; for(int i = 0; i < n; i++) y[i] = Y[i]; double lg = log(x[0]) + log(y[0]); double mx = lg; int idx = 0; for(int i = 1; i < n; i++) { lg = lg - log(y[i-1]) + log(x[i]) + log(y[i]); if(lg > mx) mx = lg, idx = i; } ll ans = 1; for(int i = 0; i <= idx; i++) ans = ans * (ll)x[i] % MOD; ans = ans * (ll)y[idx] % MOD; return ans; } int updateX(int pos, int val) { x[pos] = val; double lg = log(x[0]) + log(y[0]); double mx = lg; int idx = 0; for(int i = 1; i < n; i++) { lg = lg - log(y[i-1]) + log(x[i]) + log(y[i]); if(lg > mx) mx = lg, idx = i; } ll ans = 1; for(int i = 0; i <= idx; i++) ans = ans * (ll)x[i] % MOD; ans = ans * (ll)y[idx] % MOD; return ans; } int updateY(int pos, int val) { y[pos] = val; double lg = log(x[0]) + log(y[0]); double mx = lg; int idx = 0; for(int i = 1; i < n; i++) { lg = lg - log(y[i-1]) + log(x[i]) + log(y[i]); if(lg > mx) mx = lg, idx = i; } ll ans = 1; for(int i = 0; i <= idx; i++) ans = ans * (ll)x[i] % MOD; ans = ans * (ll)y[idx] % MOD; return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 468 KB | Output is correct |
3 | Correct | 2 ms | 468 KB | Output is correct |
4 | Correct | 2 ms | 468 KB | Output is correct |
5 | Correct | 2 ms | 480 KB | Output is correct |
6 | Correct | 2 ms | 484 KB | Output is correct |
7 | Correct | 3 ms | 500 KB | Output is correct |
8 | Correct | 2 ms | 544 KB | Output is correct |
9 | Correct | 2 ms | 548 KB | Output is correct |
10 | Correct | 2 ms | 680 KB | Output is correct |
11 | Correct | 3 ms | 680 KB | Output is correct |
12 | Correct | 2 ms | 752 KB | Output is correct |
13 | Correct | 2 ms | 752 KB | Output is correct |
14 | Correct | 2 ms | 752 KB | Output is correct |
15 | Correct | 2 ms | 752 KB | Output is correct |
16 | Correct | 2 ms | 752 KB | Output is correct |
17 | Correct | 2 ms | 752 KB | Output is correct |
18 | Correct | 2 ms | 752 KB | Output is correct |
19 | Correct | 2 ms | 752 KB | Output is correct |
20 | Correct | 2 ms | 752 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 752 KB | Output is correct |
2 | Correct | 2 ms | 752 KB | Output is correct |
3 | Correct | 2 ms | 752 KB | Output is correct |
4 | Correct | 2 ms | 752 KB | Output is correct |
5 | Correct | 2 ms | 752 KB | Output is correct |
6 | Correct | 2 ms | 752 KB | Output is correct |
7 | Correct | 2 ms | 752 KB | Output is correct |
8 | Correct | 2 ms | 752 KB | Output is correct |
9 | Correct | 2 ms | 752 KB | Output is correct |
10 | Correct | 2 ms | 752 KB | Output is correct |
11 | Correct | 2 ms | 752 KB | Output is correct |
12 | Correct | 2 ms | 752 KB | Output is correct |
13 | Correct | 2 ms | 756 KB | Output is correct |
14 | Correct | 2 ms | 760 KB | Output is correct |
15 | Correct | 2 ms | 764 KB | Output is correct |
16 | Correct | 2 ms | 768 KB | Output is correct |
17 | Correct | 2 ms | 772 KB | Output is correct |
18 | Correct | 2 ms | 776 KB | Output is correct |
19 | Correct | 2 ms | 780 KB | Output is correct |
20 | Correct | 2 ms | 780 KB | Output is correct |
21 | Correct | 2 ms | 788 KB | Output is correct |
22 | Correct | 2 ms | 1048 KB | Output is correct |
23 | Correct | 72 ms | 1048 KB | Output is correct |
24 | Correct | 75 ms | 1252 KB | Output is correct |
25 | Correct | 88 ms | 1252 KB | Output is correct |
26 | Correct | 91 ms | 1252 KB | Output is correct |
27 | Correct | 54 ms | 1252 KB | Output is correct |
28 | Correct | 85 ms | 1252 KB | Output is correct |
29 | Correct | 30 ms | 1252 KB | Output is correct |
30 | Correct | 41 ms | 1252 KB | Output is correct |
31 | Correct | 34 ms | 1252 KB | Output is correct |
32 | Correct | 32 ms | 1372 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1570 ms | 15044 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 15044 KB | Output is correct |
2 | Correct | 2 ms | 15044 KB | Output is correct |
3 | Correct | 2 ms | 15044 KB | Output is correct |
4 | Correct | 2 ms | 15044 KB | Output is correct |
5 | Correct | 2 ms | 15044 KB | Output is correct |
6 | Correct | 2 ms | 15044 KB | Output is correct |
7 | Correct | 2 ms | 15044 KB | Output is correct |
8 | Correct | 2 ms | 15044 KB | Output is correct |
9 | Correct | 2 ms | 15044 KB | Output is correct |
10 | Correct | 2 ms | 15044 KB | Output is correct |
11 | Correct | 2 ms | 15044 KB | Output is correct |
12 | Correct | 2 ms | 15044 KB | Output is correct |
13 | Correct | 2 ms | 15044 KB | Output is correct |
14 | Correct | 2 ms | 15044 KB | Output is correct |
15 | Correct | 2 ms | 15044 KB | Output is correct |
16 | Correct | 2 ms | 15044 KB | Output is correct |
17 | Correct | 2 ms | 15044 KB | Output is correct |
18 | Correct | 2 ms | 15044 KB | Output is correct |
19 | Correct | 2 ms | 15044 KB | Output is correct |
20 | Correct | 2 ms | 15044 KB | Output is correct |
21 | Correct | 2 ms | 15044 KB | Output is correct |
22 | Correct | 2 ms | 15044 KB | Output is correct |
23 | Correct | 78 ms | 15044 KB | Output is correct |
24 | Correct | 75 ms | 15044 KB | Output is correct |
25 | Correct | 98 ms | 15044 KB | Output is correct |
26 | Correct | 84 ms | 15044 KB | Output is correct |
27 | Correct | 45 ms | 15044 KB | Output is correct |
28 | Correct | 85 ms | 15044 KB | Output is correct |
29 | Correct | 29 ms | 15044 KB | Output is correct |
30 | Correct | 42 ms | 15044 KB | Output is correct |
31 | Correct | 31 ms | 15044 KB | Output is correct |
32 | Correct | 33 ms | 15044 KB | Output is correct |
33 | Execution timed out | 1578 ms | 19452 KB | Time limit exceeded |
34 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 19452 KB | Output is correct |
2 | Correct | 2 ms | 19452 KB | Output is correct |
3 | Correct | 2 ms | 19452 KB | Output is correct |
4 | Correct | 2 ms | 19452 KB | Output is correct |
5 | Correct | 2 ms | 19452 KB | Output is correct |
6 | Correct | 2 ms | 19452 KB | Output is correct |
7 | Correct | 2 ms | 19452 KB | Output is correct |
8 | Correct | 2 ms | 19452 KB | Output is correct |
9 | Correct | 2 ms | 19452 KB | Output is correct |
10 | Correct | 2 ms | 19452 KB | Output is correct |
11 | Correct | 2 ms | 19452 KB | Output is correct |
12 | Correct | 3 ms | 19452 KB | Output is correct |
13 | Correct | 2 ms | 19452 KB | Output is correct |
14 | Correct | 2 ms | 19452 KB | Output is correct |
15 | Correct | 2 ms | 19452 KB | Output is correct |
16 | Correct | 2 ms | 19452 KB | Output is correct |
17 | Correct | 2 ms | 19452 KB | Output is correct |
18 | Correct | 2 ms | 19452 KB | Output is correct |
19 | Correct | 2 ms | 19452 KB | Output is correct |
20 | Correct | 2 ms | 19452 KB | Output is correct |
21 | Correct | 2 ms | 19452 KB | Output is correct |
22 | Correct | 2 ms | 19452 KB | Output is correct |
23 | Correct | 72 ms | 19452 KB | Output is correct |
24 | Correct | 74 ms | 19452 KB | Output is correct |
25 | Correct | 89 ms | 19452 KB | Output is correct |
26 | Correct | 115 ms | 19452 KB | Output is correct |
27 | Correct | 43 ms | 19452 KB | Output is correct |
28 | Correct | 86 ms | 19452 KB | Output is correct |
29 | Correct | 68 ms | 19452 KB | Output is correct |
30 | Correct | 56 ms | 19452 KB | Output is correct |
31 | Correct | 30 ms | 19452 KB | Output is correct |
32 | Correct | 31 ms | 19452 KB | Output is correct |
33 | Execution timed out | 1576 ms | 21856 KB | Time limit exceeded |
34 | Halted | 0 ms | 0 KB | - |