# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
116945 | 2019-06-14T08:13:58 Z | someone_aa | Horses (IOI15_horses) | C++17 | 30 ms | 15368 KB |
#include "horses.h" #include <bits/stdc++.h> #define ll long long using namespace std; const int maxn = 100100; const ll mod = 1e9 + 7; ll x[maxn], y[maxn], n; int solve() { if(n <= 1000) { ll result = (1LL * x[0] * y[0])%mod; ll prod = 1LL; ll pref = x[0]; ll ind = 0; for(int i=1;i<n;i++) { prod *= x[i]; ll curr = prod * y[i]; pref *= x[i]; pref %= mod; if(curr >= y[ind]) { // buy this one result = (pref * y[i])%mod; prod = 1LL; ind = i; } } return result%mod; } else { ll result = (1LL * x[n-40] * y[n-40])%mod; ll prod = 1LL; ll pref = x[0]; ll ind = 0; for(int i=n-39;i<n;i++) { prod *= x[i]; ll curr = prod * y[i]; pref *= x[i]; pref %= mod; if(curr >= y[ind]) { // buy this one result = (pref * y[i])%mod; prod = 1LL; ind = i; } } return result%mod; } } int init(int N, int X[], int Y[]) { n = N; for(int i=0;i<N;i++) { x[i] = X[i]; y[i] = Y[i]; } return solve(); } int updateX(int pos, int val) { x[pos] = val; return solve(); } int updateY(int pos, int val) { y[pos] = val; return solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 256 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 256 KB | Output is correct |
16 | Correct | 2 ms | 256 KB | Output is correct |
17 | Correct | 2 ms | 384 KB | Output is correct |
18 | Correct | 3 ms | 256 KB | Output is correct |
19 | Correct | 2 ms | 384 KB | Output is correct |
20 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 256 KB | Output is correct |
17 | Correct | 2 ms | 384 KB | Output is correct |
18 | Correct | 2 ms | 384 KB | Output is correct |
19 | Correct | 2 ms | 384 KB | Output is correct |
20 | Correct | 2 ms | 384 KB | Output is correct |
21 | Correct | 2 ms | 256 KB | Output is correct |
22 | Correct | 2 ms | 384 KB | Output is correct |
23 | Correct | 7 ms | 384 KB | Output is correct |
24 | Correct | 7 ms | 384 KB | Output is correct |
25 | Correct | 8 ms | 384 KB | Output is correct |
26 | Correct | 8 ms | 384 KB | Output is correct |
27 | Correct | 7 ms | 384 KB | Output is correct |
28 | Correct | 8 ms | 384 KB | Output is correct |
29 | Correct | 8 ms | 384 KB | Output is correct |
30 | Correct | 8 ms | 384 KB | Output is correct |
31 | Correct | 8 ms | 384 KB | Output is correct |
32 | Correct | 7 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 19 ms | 11520 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 3 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 428 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 2 ms | 384 KB | Output is correct |
18 | Correct | 2 ms | 384 KB | Output is correct |
19 | Correct | 2 ms | 356 KB | Output is correct |
20 | Correct | 2 ms | 300 KB | Output is correct |
21 | Correct | 2 ms | 384 KB | Output is correct |
22 | Correct | 2 ms | 384 KB | Output is correct |
23 | Correct | 8 ms | 384 KB | Output is correct |
24 | Correct | 8 ms | 384 KB | Output is correct |
25 | Correct | 9 ms | 384 KB | Output is correct |
26 | Correct | 9 ms | 512 KB | Output is correct |
27 | Correct | 8 ms | 384 KB | Output is correct |
28 | Correct | 11 ms | 512 KB | Output is correct |
29 | Correct | 9 ms | 384 KB | Output is correct |
30 | Correct | 10 ms | 384 KB | Output is correct |
31 | Correct | 8 ms | 384 KB | Output is correct |
32 | Correct | 8 ms | 384 KB | Output is correct |
33 | Runtime error | 30 ms | 15368 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
34 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 432 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 256 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 2 ms | 384 KB | Output is correct |
18 | Correct | 2 ms | 256 KB | Output is correct |
19 | Correct | 2 ms | 384 KB | Output is correct |
20 | Correct | 2 ms | 384 KB | Output is correct |
21 | Correct | 2 ms | 384 KB | Output is correct |
22 | Correct | 2 ms | 384 KB | Output is correct |
23 | Correct | 9 ms | 384 KB | Output is correct |
24 | Correct | 8 ms | 384 KB | Output is correct |
25 | Correct | 9 ms | 460 KB | Output is correct |
26 | Correct | 9 ms | 384 KB | Output is correct |
27 | Correct | 8 ms | 384 KB | Output is correct |
28 | Correct | 8 ms | 384 KB | Output is correct |
29 | Correct | 13 ms | 372 KB | Output is correct |
30 | Correct | 8 ms | 384 KB | Output is correct |
31 | Correct | 8 ms | 384 KB | Output is correct |
32 | Correct | 8 ms | 384 KB | Output is correct |
33 | Runtime error | 21 ms | 13560 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
34 | Halted | 0 ms | 0 KB | - |