# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
929086 | 2024-02-17T16:35:14 Z | OAleksa | 말 (IOI15_horses) | C++14 | 1500 ms | 13916 KB |
#include "horses.h" #include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int inf = 1e9 + 69; const int N = 5e5 + 69; int n, a[N], b[N], c[N]; int mul(int a, int b) { long long r = 1ll * a * b; if (r >= mod) r %= mod; return r; } int Solve() { /* int ptr = n - 1, s = a[n - 1]; c[n - 1] = n - 1; for (int i = n - 2;i >= 0;i--) { if (a[i] > inf / s) { while (a[i] > inf / s) { s /= a[ptr]; ptr--; } c[i] = ptr; } else { c[i] = c[i + 1]; s *= a[i]; } }*/ long long ans = 1, x = a[0]; int bst = 0; for (int i = 1;i < n;i++) { if (x > inf / a[i]) { x = 1; bst = i; } else { x *= a[i]; if (b[i] > b[bst] / x) { x = 1; bst = i; } } } for (int i = 0;i <= bst;i++) ans = mul(ans, a[i]); return mul(ans, b[bst]); } int init(int N, int X[], int Y[]) { n = N; for (int i = 0;i < n;i++) a[i] = X[i], b[i] = Y[i]; return Solve(); } int updateX(int pos, int val) { a[pos] = val; return Solve(); } int updateY(int pos, int val) { b[pos] = val; return Solve(); } /* 3 2 1 3 3 4 1 1 2 1 2 */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4440 KB | Output is correct |
2 | Correct | 1 ms | 4444 KB | Output is correct |
3 | Correct | 1 ms | 4444 KB | Output is correct |
4 | Correct | 1 ms | 4444 KB | Output is correct |
5 | Correct | 1 ms | 4444 KB | Output is correct |
6 | Correct | 1 ms | 4444 KB | Output is correct |
7 | Correct | 1 ms | 4440 KB | Output is correct |
8 | Correct | 1 ms | 4444 KB | Output is correct |
9 | Correct | 1 ms | 4444 KB | Output is correct |
10 | Correct | 1 ms | 4444 KB | Output is correct |
11 | Correct | 1 ms | 4544 KB | Output is correct |
12 | Correct | 1 ms | 4444 KB | Output is correct |
13 | Correct | 1 ms | 4444 KB | Output is correct |
14 | Correct | 1 ms | 4444 KB | Output is correct |
15 | Correct | 1 ms | 4444 KB | Output is correct |
16 | Correct | 1 ms | 4444 KB | Output is correct |
17 | Correct | 1 ms | 4444 KB | Output is correct |
18 | Correct | 1 ms | 4696 KB | Output is correct |
19 | Correct | 1 ms | 4440 KB | Output is correct |
20 | Correct | 1 ms | 4440 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4444 KB | Output is correct |
2 | Correct | 1 ms | 4444 KB | Output is correct |
3 | Correct | 1 ms | 4444 KB | Output is correct |
4 | Correct | 1 ms | 4444 KB | Output is correct |
5 | Correct | 1 ms | 4444 KB | Output is correct |
6 | Correct | 1 ms | 4444 KB | Output is correct |
7 | Correct | 1 ms | 4444 KB | Output is correct |
8 | Correct | 1 ms | 4444 KB | Output is correct |
9 | Correct | 1 ms | 4444 KB | Output is correct |
10 | Correct | 1 ms | 4444 KB | Output is correct |
11 | Correct | 1 ms | 4440 KB | Output is correct |
12 | Correct | 1 ms | 4444 KB | Output is correct |
13 | Correct | 1 ms | 4544 KB | Output is correct |
14 | Correct | 1 ms | 4440 KB | Output is correct |
15 | Correct | 1 ms | 4444 KB | Output is correct |
16 | Correct | 1 ms | 4444 KB | Output is correct |
17 | Correct | 1 ms | 4444 KB | Output is correct |
18 | Correct | 1 ms | 4696 KB | Output is correct |
19 | Correct | 1 ms | 4444 KB | Output is correct |
20 | Correct | 1 ms | 4444 KB | Output is correct |
21 | Correct | 1 ms | 4444 KB | Output is correct |
22 | Correct | 1 ms | 4444 KB | Output is correct |
23 | Correct | 17 ms | 4588 KB | Output is correct |
24 | Correct | 17 ms | 4588 KB | Output is correct |
25 | Correct | 14 ms | 4440 KB | Output is correct |
26 | Correct | 14 ms | 4440 KB | Output is correct |
27 | Correct | 18 ms | 4444 KB | Output is correct |
28 | Correct | 18 ms | 4580 KB | Output is correct |
29 | Correct | 15 ms | 4444 KB | Output is correct |
30 | Correct | 15 ms | 4444 KB | Output is correct |
31 | Correct | 17 ms | 4444 KB | Output is correct |
32 | Correct | 19 ms | 4444 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1561 ms | 9820 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4440 KB | Output is correct |
2 | Correct | 1 ms | 4444 KB | Output is correct |
3 | Correct | 1 ms | 4444 KB | Output is correct |
4 | Correct | 1 ms | 4444 KB | Output is correct |
5 | Correct | 1 ms | 4440 KB | Output is correct |
6 | Correct | 1 ms | 4444 KB | Output is correct |
7 | Correct | 1 ms | 4444 KB | Output is correct |
8 | Correct | 1 ms | 4444 KB | Output is correct |
9 | Correct | 1 ms | 4440 KB | Output is correct |
10 | Correct | 1 ms | 4440 KB | Output is correct |
11 | Correct | 1 ms | 4444 KB | Output is correct |
12 | Correct | 1 ms | 4504 KB | Output is correct |
13 | Correct | 1 ms | 4444 KB | Output is correct |
14 | Correct | 1 ms | 4444 KB | Output is correct |
15 | Correct | 1 ms | 4444 KB | Output is correct |
16 | Correct | 1 ms | 4444 KB | Output is correct |
17 | Correct | 1 ms | 4444 KB | Output is correct |
18 | Correct | 1 ms | 4444 KB | Output is correct |
19 | Correct | 1 ms | 4444 KB | Output is correct |
20 | Correct | 1 ms | 4444 KB | Output is correct |
21 | Correct | 1 ms | 4444 KB | Output is correct |
22 | Correct | 1 ms | 4444 KB | Output is correct |
23 | Correct | 17 ms | 4580 KB | Output is correct |
24 | Correct | 17 ms | 4444 KB | Output is correct |
25 | Correct | 14 ms | 4444 KB | Output is correct |
26 | Correct | 14 ms | 4592 KB | Output is correct |
27 | Correct | 18 ms | 4444 KB | Output is correct |
28 | Correct | 18 ms | 4444 KB | Output is correct |
29 | Correct | 14 ms | 4444 KB | Output is correct |
30 | Correct | 14 ms | 4444 KB | Output is correct |
31 | Correct | 18 ms | 4584 KB | Output is correct |
32 | Correct | 18 ms | 4444 KB | Output is correct |
33 | Execution timed out | 1541 ms | 13916 KB | Time limit exceeded |
34 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4444 KB | Output is correct |
2 | Correct | 1 ms | 4444 KB | Output is correct |
3 | Correct | 1 ms | 4696 KB | Output is correct |
4 | Correct | 1 ms | 4444 KB | Output is correct |
5 | Correct | 1 ms | 4444 KB | Output is correct |
6 | Correct | 1 ms | 4444 KB | Output is correct |
7 | Correct | 1 ms | 4444 KB | Output is correct |
8 | Correct | 1 ms | 4444 KB | Output is correct |
9 | Correct | 1 ms | 4444 KB | Output is correct |
10 | Correct | 1 ms | 4444 KB | Output is correct |
11 | Correct | 1 ms | 4444 KB | Output is correct |
12 | Correct | 1 ms | 4444 KB | Output is correct |
13 | Correct | 1 ms | 4444 KB | Output is correct |
14 | Correct | 1 ms | 4444 KB | Output is correct |
15 | Correct | 1 ms | 4444 KB | Output is correct |
16 | Correct | 1 ms | 4444 KB | Output is correct |
17 | Correct | 1 ms | 4444 KB | Output is correct |
18 | Correct | 1 ms | 4444 KB | Output is correct |
19 | Correct | 1 ms | 4444 KB | Output is correct |
20 | Correct | 1 ms | 4444 KB | Output is correct |
21 | Correct | 1 ms | 4444 KB | Output is correct |
22 | Correct | 1 ms | 4440 KB | Output is correct |
23 | Correct | 17 ms | 4440 KB | Output is correct |
24 | Correct | 17 ms | 4440 KB | Output is correct |
25 | Correct | 14 ms | 4444 KB | Output is correct |
26 | Correct | 14 ms | 4584 KB | Output is correct |
27 | Correct | 18 ms | 4444 KB | Output is correct |
28 | Correct | 18 ms | 4572 KB | Output is correct |
29 | Correct | 14 ms | 4444 KB | Output is correct |
30 | Correct | 14 ms | 4444 KB | Output is correct |
31 | Correct | 18 ms | 4560 KB | Output is correct |
32 | Correct | 20 ms | 4444 KB | Output is correct |
33 | Execution timed out | 1577 ms | 12236 KB | Time limit exceeded |
34 | Halted | 0 ms | 0 KB | - |