# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
747474 | 2023-05-24T08:11:18 Z | Desh03 | 말 (IOI15_horses) | C++17 | 251 ms | 36976 KB |
#include "horses.h" #include <bits/stdc++.h> using namespace std; const int mod = 1000000007; vector<int> x, y; int n; struct segtree1 { vector<double> st, lz; vector<int> id; int sz; void init(vector<double> a) { sz = a.size(); while (sz & sz - 1) ++sz; st.resize(sz << 1), lz.resize(sz << 1), id.resize(sz << 1); for (int i = 0; i < a.size(); i++) st[i + sz] = a[i] + log(y[i]), id[i + sz] = i; for (int i = sz - 1; i; i--) pull(i); } void pull(int v) { if (st[v << 1] >= st[v << 1 | 1]) { st[v] = st[v << 1], id[v] = id[v << 1]; } else { st[v] = st[v << 1 | 1], id[v] = id[v << 1 | 1]; } } void push(int v) { st[v << 1] += lz[v]; st[v << 1 | 1] += lz[v]; lz[v << 1] += lz[v]; lz[v << 1 | 1] += lz[v]; lz[v] = 0; } void updx(int v, int l, int r, int ql, int qr, double x) { if (l > qr || r < ql) return; if (l >= ql && r <= qr) { st[v] += x, lz[v] += x; return; } push(v); int m = l + r >> 1; updx(v << 1, l, m, ql, qr, x); updx(v << 1 | 1, m + 1, r, ql, qr, x); pull(v); } void updy(int v, int l, int r, int u, double y) { if (l == r) { st[v] += y; return; } push(v); int m = l + r >> 1; if (u <= m) updy(v << 1, l, m, u, y); else updy(v << 1 | 1, m + 1, r, u, y); pull(v); } void updx(int l, int r, double x) { updx(1, 0, sz - 1, l, r, x); } void updy(int u, double y) { updy(1, 0, sz - 1, u, y); } } st1; struct segtree2 { vector<int> st; int sz; void init(int n) { sz = n; st.resize(sz << 1); } void upd(int id, int x) { for (st[id += sz] = x; id >>= 1;) st[id] = 1LL * st[id << 1] * st[id << 1 | 1] % mod; } int qry(int l, int r) { int s = 1; for (l += sz, r += sz + 1; l < r; l >>= 1, r >>= 1) { if (l & 1) s = 1LL * s * st[l++] % mod; if (r & 1) s = 1LL * s * st[--r] % mod; } return s; } } st2; int init(int N, int X[], int Y[]) { n = N, x.resize(n), y.resize(n); for (int i = 0; i < n; i++) x[i] = X[i], y[i] = Y[i]; vector<double> p(n); p[0] = log(x[0]); for (int i = 1; i < n; i++) p[i] = p[i - 1] + log(x[i]); st1.init(p); st2.init(n); for (int i = 0; i < n; i++) st2.upd(i, x[i]); return 1LL * st2.qry(0, st1.id[1]) * y[st1.id[1]] % mod; } int updateX(int pos, int val) { st1.updx(pos, n - 1, log(val) - log(x[pos])); st2.upd(pos, val); x[pos] = val; return 1LL * st2.qry(0, st1.id[1]) * y[st1.id[1]] % mod; } int updateY(int pos, int val) { st1.updy(pos, log(val) - log(y[pos])); y[pos] = val; return 1LL * st2.qry(0, st1.id[1]) * y[st1.id[1]] % mod; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 1 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 146 ms | 36436 KB | Output is correct |
2 | Correct | 248 ms | 36480 KB | Output is correct |
3 | Correct | 201 ms | 36508 KB | Output is correct |
4 | Correct | 246 ms | 36500 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 292 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 1 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 112 ms | 36496 KB | Output is correct |
34 | Correct | 112 ms | 36488 KB | Output is correct |
35 | Correct | 131 ms | 36496 KB | Output is correct |
36 | Correct | 128 ms | 36464 KB | Output is correct |
37 | Correct | 100 ms | 36592 KB | Output is correct |
38 | Correct | 103 ms | 36440 KB | Output is correct |
39 | Correct | 96 ms | 36496 KB | Output is correct |
40 | Correct | 115 ms | 36468 KB | Output is correct |
41 | Correct | 94 ms | 36516 KB | Output is correct |
42 | Correct | 99 ms | 36496 KB | Output is correct |
43 | Incorrect | 106 ms | 36472 KB | Output isn't correct |
44 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 372 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 1 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 135 ms | 36436 KB | Output is correct |
34 | Correct | 246 ms | 36500 KB | Output is correct |
35 | Correct | 207 ms | 36456 KB | Output is correct |
36 | Correct | 251 ms | 36564 KB | Output is correct |
37 | Correct | 113 ms | 36740 KB | Output is correct |
38 | Correct | 117 ms | 36760 KB | Output is correct |
39 | Correct | 138 ms | 36764 KB | Output is correct |
40 | Correct | 129 ms | 36680 KB | Output is correct |
41 | Correct | 104 ms | 36880 KB | Output is correct |
42 | Correct | 111 ms | 36880 KB | Output is correct |
43 | Correct | 105 ms | 36976 KB | Output is correct |
44 | Correct | 128 ms | 36872 KB | Output is correct |
45 | Correct | 108 ms | 36880 KB | Output is correct |
46 | Correct | 94 ms | 36812 KB | Output is correct |
47 | Incorrect | 108 ms | 36820 KB | Output isn't correct |
48 | Halted | 0 ms | 0 KB | - |