#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m, t, l;
cin >> n >> m >> t >> l;
vector<vector<pair<int, int>>> g(n);
for (int i = 0; i < m; i++) {
int x, y, z;
cin >> x >> y >> z;
--x; --y;
g[x].emplace_back(y, z);
g[y].emplace_back(x, z);
}
vector<int> seq(l);
for (int i = 0; i < l; i++) {
cin >> seq[i];
--seq[i];
}
vector<int> deg(n);
for (int i = 0; i < n; i++) {
deg[i] = (int) g[i].size();
}
vector<vector<int>> idx(n, vector<int>(n));
for (int i = 0; i < n; i++) {
for (int j = 0; j < deg[i]; j++) {
idx[i][g[i][j].first] = j;
}
}
const long long inf = (long long) 1e18;
vector<vector<vector<vector<long long>>>> dist(n, vector<vector<vector<long long>>>(n));
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (i == j) {
continue;
}
dist[i][j].resize(deg[i]);
for (int k = 0; k < deg[i]; k++) {
dist[i][j][k] = vector<long long>(deg[j], inf);
}
}
}
vector<vector<long long>> d(n);
for (int i = 0; i < n; i++) {
d[i].resize(deg[i]);
}
vector<int> ia(n), ib(n);
set<tuple<long long, int, int>> que;
for (int ver = 0; ver < n; ver++) {
for (int e = 0; e < deg[ver]; e++) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < deg[i]; j++) {
d[i][j] = inf;
}
ia[i] = -1;
ib[i] = -1;
}
int to = g[ver][e].first;
int w = g[ver][e].second;
d[to][idx[to][ver]] = w;
que.clear();
que.emplace(d[to][idx[to][ver]], to, idx[to][ver]);
ia[to] = idx[to][ver];
auto Update = [&](int x, int y, long long z) {
if (ia[x] == y || ib[x] == y) {
que.erase(que.find({d[x][y], x, y}));
}
d[x][y] = z;
if (ia[x] == y) {
return;
}
if (ib[x] == y) {
if (d[x][y] < d[x][ia[x]]) {
swap(ia[x], ib[x]);
}
return;
}
if (ia[x] == -1) {
ia[x] = y;
que.emplace(d[x][y], x, y);
return;
}
if (ib[x] == -1) {
if (d[x][y] < d[x][ia[x]]) {
swap(ia[x], ib[x]);
ia[x] = y;
} else {
ib[x] = y;
}
que.emplace(d[x][y], x, y);
return;
}
if (d[x][y] >= d[x][ia[x]] && d[x][y] < d[x][ib[x]]) {
que.erase(que.find({d[x][ib[x]], x, ib[x]}));
ib[x] = y;
que.emplace(d[x][y], x, y);
return;
}
if (d[x][y] < d[x][ia[x]]) {
que.erase(que.find({d[x][ib[x]], x, ib[x]}));
swap(ia[x], ib[x]);
ia[x] = y;
que.emplace(d[x][y], x, y);
}
};
while (!que.empty()) {
auto it = que.begin();
int v = get<1>(*it);
int lst = get<2>(*it);
que.erase(it);
for (int i = 0; i < deg[v]; i++) {
if (i == lst) {
continue;
}
int to = g[v][i].first;
int w = g[v][i].second;
if (d[to][idx[to][v]] > d[v][lst] + w) {
Update(to, idx[to][v], d[v][lst] + w);
assert((int) que.size() <= 2 * n);
}
}
}
for (int i = ver + 1; i < n; i++) {
if (i == ver) {
continue;
}
for (int j = 0; j < deg[i]; j++) {
dist[ver][i][e][j] = d[i][j];
}
}
}
}
vector<vector<vector<vector<int>>>> good(n, vector<vector<vector<int>>>(n, vector<vector<int>>(2)));
vector<vector<int>> cc(n, vector<int>(2));
for (int from = 0; from < n; from++) {
for (int to = 0; to < n; to++) {
if (from == to) {
continue;
}
vector<pair<int, int>> order;
for (int i = 0; i < deg[from]; i++) {
for (int j = 0; j < deg[to]; j++) {
order.emplace_back(i, j);
}
}
if (from <= to) {
sort(order.begin(), order.end(), [&](pair<int, int> a, pair<int, int> b) {
return dist[from][to][a.first][a.second] < dist[from][to][b.first][b.second];
});
} else {
sort(order.begin(), order.end(), [&](pair<int, int> a, pair<int, int> b) {
return dist[to][from][a.second][a.first] < dist[to][from][b.second][b.first];
});
}
int total = 0;
for (auto& p : order) {
if (cc[p.first][0] >= 2 || cc[p.second][1] >= 2) {
continue;
}
good[from][to][0].push_back(p.first);
good[from][to][1].push_back(p.second);
cc[p.first][0] += 1;
cc[p.second][1] += 1;
total += 1;
if (total >= 5) {
break;
}
}
for (int t = 0; t < 2; t++) {
sort(good[from][to][t].begin(), good[from][to][t].end());
good[from][to][t].erase(unique(good[from][to][t].begin(), good[from][to][t].end()), good[from][to][t].end());
}
for (int i = 0; i < deg[from]; i++) {
cc[i][0] = 0;
}
for (int i = 0; i < deg[to]; i++) {
cc[i][1] = 0;
}
}
}
vector<vector<vector<int>>> f(l, vector<vector<int>>(2));
auto Update = [&](int i) {
f[i][0].clear();
f[i][1].clear();
if (i > 0) {
for (int j : good[seq[i - 1]][seq[i]][1]) {
f[i][0].push_back(j);
}
}
if (i + 1 < l) {
for (int j : good[seq[i]][seq[i + 1]][0]) {
f[i][1].push_back(j);
}
}
};
vector<vector<vector<long long>>> st(4 * l);
auto Pull = [&](int x, int l, int r) {
int mid = l + r >> 1;
st[x].clear();
for (int ll = 0; ll < (int) st[x * 2].size(); ll++) {
for (int lr = 0; lr < (int) st[x * 2][ll].size(); lr++) {
if (st[x].empty()) {
st[x].resize((int) st[x * 2].size());
}
for (int rl = 0; rl < (int) st[x * 2 + 1].size(); rl++) {
if (st[x][ll].empty()) {
st[x][ll] = vector<long long>((int) st[x * 2 + 1][rl].size(), inf);
}
if (f[mid + 1][0][lr] == f[mid + 1][1][rl]) {
continue;
}
if (st[x * 2][ll][lr] != inf) {
for (int rr = 0; rr < (int) st[x * 2 + 1][rl].size(); rr++) {
st[x][ll][rr] = min(st[x][ll][rr], st[x * 2][ll][lr] + st[x * 2 + 1][rl][rr]);
}
}
}
}
}
};
function<void(int, int, int)> Build = [&](int x, int l, int r) {
if (l == r) {
st[x].resize(f[l][1].size());
for (int i = 0; i < f[l][1].size(); i++) {
st[x][i] = vector<long long>(f[l + 1][0].size(), inf);
}
for (int i = 0; i < f[l][1].size(); i++) {
for (int j = 0; j < f[l + 1][0].size(); j++) {
if (seq[l] <= seq[l + 1]) {
st[x][i][j] = min(st[x][i][j], dist[seq[l]][seq[l + 1]][f[l][1][i]][f[l + 1][0][j]]);
} else {
st[x][i][j] = min(st[x][i][j], dist[seq[l + 1]][seq[l]][f[l + 1][0][j]][f[l][1][i]]);
}
}
}
return;
}
int mid = l + r >> 1;
Build(x * 2, l, mid);
Build(x * 2 + 1, mid + 1, r);
Pull(x, l, r);
};
function<void(int, int, int, int)> Modify = [&](int x, int l, int r, int p) {
if (l == r) {
st[x].resize(f[l][1].size());
for (int i = 0; i < f[l][1].size(); i++) {
st[x][i] = vector<long long>(f[l + 1][0].size(), inf);
}
for (int i = 0; i < f[l][1].size(); i++) {
for (int j = 0; j < f[l + 1][0].size(); j++) {
if (seq[l] <= seq[l + 1]) {
st[x][i][j] = min(st[x][i][j], dist[seq[l]][seq[l + 1]][f[l][1][i]][f[l + 1][0][j]]);
} else {
st[x][i][j] = min(st[x][i][j], dist[seq[l + 1]][seq[l]][f[l + 1][0][j]][f[l][1][i]]);
}
}
}
return;
}
int mid = l + r >> 1;
if (p <= mid) {
Modify(x * 2, l, mid, p);
} else {
Modify(x * 2 + 1, mid + 1, r, p);
}
Pull(x, l, r);
};
for (int i = 0; i < l; i++) {
Update(i);
}
Build(1, 0, l - 2);
auto Solve = [&]() {
long long res = inf;
for (int i = 0; i < st[1].size(); i++) {
for (int j = 0; j < st[1][i].size(); j++) {
res = min(res, st[1][i][j]);
}
}
return (res == inf ? -1LL : res);
};
while (t--) {
int p, x;
cin >> p >> x;
--p; --x;
seq[p] = x;
Update(p);
if (p > 0) {
Update(p - 1);
}
if (p + 1 < l) {
Update(p + 1);
}
if (p <= l - 2) {
Modify(1, 0, l - 2, p);
}
if (p + 1 <= l - 2) {
Modify(1, 0, l - 2, p + 1);
}
if (p + 2 <= l - 2) {
Modify(1, 0, l - 2, p + 2);
}
if (p > 0) {
Modify(1, 0, l - 2, p - 1);
}
if (p > 1) {
Modify(1, 0, l - 2, p - 2);
}
cout << Solve() << '\n';
}
return 0;
}
Compilation message
wild_boar.cpp: In lambda function:
wild_boar.cpp:201:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
201 | int mid = l + r >> 1;
| ~~^~~
wild_boar.cpp: In lambda function:
wild_boar.cpp:227:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
227 | for (int i = 0; i < f[l][1].size(); i++) {
| ~~^~~~~~~~~~~~~~~~
wild_boar.cpp:230:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
230 | for (int i = 0; i < f[l][1].size(); i++) {
| ~~^~~~~~~~~~~~~~~~
wild_boar.cpp:231:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
231 | for (int j = 0; j < f[l + 1][0].size(); j++) {
| ~~^~~~~~~~~~~~~~~~~~~~
wild_boar.cpp:241:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
241 | int mid = l + r >> 1;
| ~~^~~
wild_boar.cpp: In lambda function:
wild_boar.cpp:249:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
249 | for (int i = 0; i < f[l][1].size(); i++) {
| ~~^~~~~~~~~~~~~~~~
wild_boar.cpp:252:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
252 | for (int i = 0; i < f[l][1].size(); i++) {
| ~~^~~~~~~~~~~~~~~~
wild_boar.cpp:253:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
253 | for (int j = 0; j < f[l + 1][0].size(); j++) {
| ~~^~~~~~~~~~~~~~~~~~~~
wild_boar.cpp:263:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
263 | int mid = l + r >> 1;
| ~~^~~
wild_boar.cpp: In lambda function:
wild_boar.cpp:277:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
277 | for (int i = 0; i < st[1].size(); i++) {
| ~~^~~~~~~~~~~~~~
wild_boar.cpp:278:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
278 | for (int j = 0; j < st[1][i].size(); j++) {
| ~~^~~~~~~~~~~~~~~~~
# |
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 |
1 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 |
1 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 |
1 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 |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
428 KB |
Output is correct |
25 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
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 |
1 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 |
1 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 |
1 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 |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
428 KB |
Output is correct |
25 |
Correct |
0 ms |
344 KB |
Output is correct |
26 |
Correct |
2 ms |
604 KB |
Output is correct |
27 |
Correct |
125 ms |
48512 KB |
Output is correct |
28 |
Correct |
116 ms |
48212 KB |
Output is correct |
29 |
Correct |
250 ms |
70736 KB |
Output is correct |
30 |
Correct |
302 ms |
84056 KB |
Output is correct |
31 |
Correct |
333 ms |
97012 KB |
Output is correct |
32 |
Correct |
321 ms |
94800 KB |
Output is correct |
33 |
Correct |
247 ms |
67816 KB |
Output is correct |
34 |
Correct |
248 ms |
67920 KB |
Output is correct |
35 |
Correct |
375 ms |
108116 KB |
Output is correct |
36 |
Correct |
373 ms |
105436 KB |
Output is correct |
37 |
Correct |
247 ms |
69200 KB |
Output is correct |
38 |
Correct |
237 ms |
66640 KB |
Output is correct |
39 |
Correct |
346 ms |
101184 KB |
Output is correct |
40 |
Correct |
236 ms |
66900 KB |
Output is correct |
41 |
Correct |
237 ms |
66896 KB |
Output is correct |
42 |
Correct |
344 ms |
106320 KB |
Output is correct |
43 |
Correct |
234 ms |
67844 KB |
Output is correct |
44 |
Correct |
245 ms |
67856 KB |
Output is correct |
45 |
Correct |
207 ms |
71508 KB |
Output is correct |
# |
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 |
1 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 |
1 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 |
1 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 |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
428 KB |
Output is correct |
25 |
Correct |
0 ms |
344 KB |
Output is correct |
26 |
Correct |
2 ms |
604 KB |
Output is correct |
27 |
Correct |
125 ms |
48512 KB |
Output is correct |
28 |
Correct |
116 ms |
48212 KB |
Output is correct |
29 |
Correct |
250 ms |
70736 KB |
Output is correct |
30 |
Correct |
302 ms |
84056 KB |
Output is correct |
31 |
Correct |
333 ms |
97012 KB |
Output is correct |
32 |
Correct |
321 ms |
94800 KB |
Output is correct |
33 |
Correct |
247 ms |
67816 KB |
Output is correct |
34 |
Correct |
248 ms |
67920 KB |
Output is correct |
35 |
Correct |
375 ms |
108116 KB |
Output is correct |
36 |
Correct |
373 ms |
105436 KB |
Output is correct |
37 |
Correct |
247 ms |
69200 KB |
Output is correct |
38 |
Correct |
237 ms |
66640 KB |
Output is correct |
39 |
Correct |
346 ms |
101184 KB |
Output is correct |
40 |
Correct |
236 ms |
66900 KB |
Output is correct |
41 |
Correct |
237 ms |
66896 KB |
Output is correct |
42 |
Correct |
344 ms |
106320 KB |
Output is correct |
43 |
Correct |
234 ms |
67844 KB |
Output is correct |
44 |
Correct |
245 ms |
67856 KB |
Output is correct |
45 |
Correct |
207 ms |
71508 KB |
Output is correct |
46 |
Correct |
175 ms |
16184 KB |
Output is correct |
47 |
Correct |
3094 ms |
254364 KB |
Output is correct |
48 |
Correct |
3301 ms |
349724 KB |
Output is correct |
49 |
Correct |
3619 ms |
440228 KB |
Output is correct |
50 |
Correct |
3586 ms |
433996 KB |
Output is correct |
51 |
Correct |
3566 ms |
426060 KB |
Output is correct |
52 |
Correct |
3658 ms |
399700 KB |
Output is correct |
53 |
Correct |
3696 ms |
399324 KB |
Output is correct |
54 |
Correct |
3706 ms |
399460 KB |
Output is correct |
55 |
Correct |
3642 ms |
397776 KB |
Output is correct |
56 |
Correct |
3898 ms |
443256 KB |
Output is correct |
57 |
Correct |
3999 ms |
493100 KB |
Output is correct |
58 |
Correct |
4269 ms |
542208 KB |
Output is correct |
59 |
Correct |
4514 ms |
596096 KB |
Output is correct |
60 |
Correct |
4772 ms |
652192 KB |
Output is correct |
61 |
Correct |
4810 ms |
712796 KB |
Output is correct |
62 |
Correct |
5083 ms |
778840 KB |
Output is correct |
63 |
Correct |
5122 ms |
847916 KB |
Output is correct |
64 |
Correct |
3752 ms |
1005376 KB |
Output is correct |
65 |
Correct |
3471 ms |
1005924 KB |
Output is correct |
# |
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 |
1 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 |
1 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 |
1 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 |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
428 KB |
Output is correct |
25 |
Correct |
0 ms |
344 KB |
Output is correct |
26 |
Correct |
2 ms |
604 KB |
Output is correct |
27 |
Correct |
125 ms |
48512 KB |
Output is correct |
28 |
Correct |
116 ms |
48212 KB |
Output is correct |
29 |
Correct |
250 ms |
70736 KB |
Output is correct |
30 |
Correct |
302 ms |
84056 KB |
Output is correct |
31 |
Correct |
333 ms |
97012 KB |
Output is correct |
32 |
Correct |
321 ms |
94800 KB |
Output is correct |
33 |
Correct |
247 ms |
67816 KB |
Output is correct |
34 |
Correct |
248 ms |
67920 KB |
Output is correct |
35 |
Correct |
375 ms |
108116 KB |
Output is correct |
36 |
Correct |
373 ms |
105436 KB |
Output is correct |
37 |
Correct |
247 ms |
69200 KB |
Output is correct |
38 |
Correct |
237 ms |
66640 KB |
Output is correct |
39 |
Correct |
346 ms |
101184 KB |
Output is correct |
40 |
Correct |
236 ms |
66900 KB |
Output is correct |
41 |
Correct |
237 ms |
66896 KB |
Output is correct |
42 |
Correct |
344 ms |
106320 KB |
Output is correct |
43 |
Correct |
234 ms |
67844 KB |
Output is correct |
44 |
Correct |
245 ms |
67856 KB |
Output is correct |
45 |
Correct |
207 ms |
71508 KB |
Output is correct |
46 |
Correct |
175 ms |
16184 KB |
Output is correct |
47 |
Correct |
3094 ms |
254364 KB |
Output is correct |
48 |
Correct |
3301 ms |
349724 KB |
Output is correct |
49 |
Correct |
3619 ms |
440228 KB |
Output is correct |
50 |
Correct |
3586 ms |
433996 KB |
Output is correct |
51 |
Correct |
3566 ms |
426060 KB |
Output is correct |
52 |
Correct |
3658 ms |
399700 KB |
Output is correct |
53 |
Correct |
3696 ms |
399324 KB |
Output is correct |
54 |
Correct |
3706 ms |
399460 KB |
Output is correct |
55 |
Correct |
3642 ms |
397776 KB |
Output is correct |
56 |
Correct |
3898 ms |
443256 KB |
Output is correct |
57 |
Correct |
3999 ms |
493100 KB |
Output is correct |
58 |
Correct |
4269 ms |
542208 KB |
Output is correct |
59 |
Correct |
4514 ms |
596096 KB |
Output is correct |
60 |
Correct |
4772 ms |
652192 KB |
Output is correct |
61 |
Correct |
4810 ms |
712796 KB |
Output is correct |
62 |
Correct |
5083 ms |
778840 KB |
Output is correct |
63 |
Correct |
5122 ms |
847916 KB |
Output is correct |
64 |
Correct |
3752 ms |
1005376 KB |
Output is correct |
65 |
Correct |
3471 ms |
1005924 KB |
Output is correct |
66 |
Correct |
128 ms |
63056 KB |
Output is correct |
67 |
Correct |
1183 ms |
242496 KB |
Output is correct |
68 |
Correct |
3232 ms |
960404 KB |
Output is correct |
69 |
Correct |
3475 ms |
961336 KB |
Output is correct |
70 |
Correct |
4802 ms |
1009204 KB |
Output is correct |
71 |
Correct |
9797 ms |
250592 KB |
Output is correct |
72 |
Correct |
17472 ms |
368340 KB |
Output is correct |
73 |
Correct |
8701 ms |
407120 KB |
Output is correct |
74 |
Correct |
9349 ms |
407448 KB |
Output is correct |
75 |
Correct |
8274 ms |
404848 KB |
Output is correct |
76 |
Correct |
10160 ms |
435760 KB |
Output is correct |
77 |
Correct |
13573 ms |
449640 KB |
Output is correct |
78 |
Correct |
14015 ms |
451420 KB |
Output is correct |
79 |
Correct |
6941 ms |
498948 KB |
Output is correct |
80 |
Correct |
7104 ms |
551156 KB |
Output is correct |
81 |
Correct |
11671 ms |
640648 KB |
Output is correct |
82 |
Correct |
6902 ms |
660092 KB |
Output is correct |
83 |
Correct |
13043 ms |
767644 KB |
Output is correct |
84 |
Correct |
7002 ms |
852292 KB |
Output is correct |
85 |
Correct |
5376 ms |
1008280 KB |
Output is correct |