QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#141562 | #6659. 외곽 순환 도로 2 | Forested | 6 | 607ms | 33952kb | C++17 | 5.5kb | 2023-08-17 16:37:25 | 2024-08-26 15:51:23 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define OVERRIDE4(a, b, c, d, ...) d
#define REP2(i, n) for (i32 i = 0; i < (i32)(n); ++i)
#define REP3(i, l, r) for (i32 i = (i32)(l); i < (i32)(r); ++i)
#define REP(...) OVERRIDE4(__VA_ARGS__, REP3, REP2)(__VA_ARGS__)
#define PER2(i, n) for (i32 i = (i32)(n) - 1; i >= 0; --i)
#define PER3(i, l, r) for (i32 i = (i32)(r) - 1; i >= (i32)(l); --i)
#define PER(...) OVERRIDE4(__VA_ARGS__, PER3, PER2)(__VA_ARGS__)
template <typename T>
bool chmin(T &lhs, const T &rhs) {
if (lhs > rhs) {
lhs = rhs;
return true;
}
return false;
}
template <typename T>
bool chmax(T &lhs, const T &rhs) {
if (lhs < rhs) {
lhs = rhs;
return true;
}
return false;
}
using i32 = int;
using i64 = long long;
template <typename T>
using Vec = vector<T>;
template <typename T>
void trc(const Vec<T> &a) {
cerr << "[";
REP(i, a.size()) {
if (i > 0) {
cerr << ", ";
}
cerr << a[i];
}
cerr << "]\n";
}
constexpr i32 INF = 1001001001;
constexpr i64 INF64 = 3003003003003003003LL;
struct DP {
i32 tw;
array<i64, 3> nosp;
array<array<array<i64, 3>, 3>, 2> sp;
DP() : tw(0), nosp(), sp() {
REP(i, 3) {
nosp[i] = INF64;
}
REP(i, 2) REP(j, 3) REP(k, 3) {
sp[i][j][k] = INF64;
}
}
};
bool is_ok(i64 lw, i64 lst, i64 rst) {
if (lst == 2 || rst == 2) {
return true;
}
if (lw) {
rst ^= 1;
}
return lst == rst;
}
array<i64, 3> merge_not_free(array<i64, 3> l, array<i64, 3> r, i32 lw) {
if (lw) {
swap(r[0], r[1]);
}
array<i64, 3> ret;
ret[0] = min({l[2] + r[0], l[0] + r[2], l[0] + r[0]});
ret[1] = min({l[2] + r[1], l[1] + r[2], l[1] + r[1]});
ret[2] = l[2] + r[2];
return ret;
}
DP merge(const DP &l, const DP &r, i64 w) {
DP ret;
ret.tw = l.tw ^ r.tw;
ret.nosp = merge_not_free(l.nosp, r.nosp, l.tw);
REP(ll, 3) REP(rr, 3) {
chmin(ret.sp[r.tw][ll][rr], l.nosp[ll] + r.nosp[rr] + w);
}
REP(lw, 2) REP(ll, 3) REP(lr, 3) REP(rr, 3) REP(whe, 2) {
i64 cost = l.sp[lw][ll][lr] + r.nosp[rr];
if (whe) {
cost += w;
chmin(ret.sp[r.tw][ll][rr], cost);
} else if (rr == 2) {
chmin(ret.sp[lw ^ r.tw][ll][lr], cost);
} else if (lr == 2) {
chmin(ret.sp[lw ^ r.tw][ll][rr ^ lw], cost);
} else if ((lr ^ lw) == rr) {
chmin(ret.sp[lw ^ r.tw][ll][lr], cost);
}
}
REP(lr, 3) REP(rw, 2) REP(rl, 3) REP(rr, 3) REP(whe, 2) {
i64 cost = l.nosp[lr] + r.sp[rw][rl][rr];
if (whe) {
cost += w;
chmin(ret.sp[rw][lr][rr], cost);
} else if (rl == 2) {
chmin(ret.sp[rw][lr][rr], cost);
} else if (lr == 2) {
chmin(ret.sp[rw][rl ^ l.tw][rr], cost);
} else if ((lr ^ l.tw) == rl) {
chmin(ret.sp[rw][lr][rr], cost);
}
}
REP(lw, 2) REP(ll, 3) REP(lr, 3) REP(rw, 2) REP(rl, 3) REP(rr, 3) {
i64 cost = l.sp[lw][ll][lr] + r.sp[rw][rl][rr];
if (!is_ok(lw, lr, rl)) {
cost += w;
}
chmin(ret.sp[rw][ll][rr], cost);
}
return ret;
}
DP trans(const DP &dp, i64 c) {
DP ret = dp;
chmin(ret.nosp[2], ret.nosp[0] + c);
chmin(ret.nosp[2], ret.nosp[1] + c);
REP(w, 2) REP(l, 3) REP(r, 3) {
chmin(ret.sp[w][2][2], ret.sp[w][l][r] + c);
}
return ret;
}
i64 place_police(Vec<i32> p, Vec<i64> c, Vec<i64> w) {
p.insert(p.begin(), 0);
c.insert(c.begin(), 0);
i32 n = (i32)p.size();
Vec<Vec<pair<i32, i64>>> chl(n);
REP(i, 1, n) {
chl[p[i]].emplace_back(i, c[i]);
}
Vec<i32> dep(n, 0);
Vec<i32> rch(n, 0);
i32 chc = 0;
REP(i, n) {
for (auto [ch, _] : chl[i]) {
dep[ch] = dep[i] + 1;
}
if (chl[i].empty()) {
rch[i] = chc++;
}
}
PER(i, n) {
if (!chl[i].empty()) {
rch[i] = rch[chl[i].back().first];
}
}
Vec<DP> dp(n);
PER(i, n) {
if (chl[i].empty()) {
dp[i].tw = 1;
dp[i].nosp[dep[i] % 2] = 0;
} else {
Vec<DP> lst;
lst.reserve(chl[i].size());
for (auto [ch, cost] : chl[i]) {
lst.push_back(trans(dp[ch], cost));
}
dp[i] = lst.front();
REP(j, 1, lst.size()) {
dp[i] = merge(dp[i], lst[j], w[rch[chl[i][j - 1].first]]);
REP(x, 3) {
cerr << dp[i].nosp[x] << " \n"[x == 2];
}
REP(x, 2) REP(y, 3) REP(z, 3) {
cerr << dp[0].sp[x][y][z] << " \n"[z == 2];
}
}
}
}
i64 ans = INF64;
if (w.size() % 2 == 0) {
chmin(ans, dp[0].nosp[0]);
chmin(ans, dp[0].nosp[1]);
chmin(ans, dp[0].nosp[2]);
} else {
chmin(ans, dp[0].nosp[0] + w.back());
chmin(ans, dp[0].nosp[1] + w.back());
chmin(ans, dp[0].nosp[2] + w.back());
}
REP(wi, 2) REP(l, 3) REP(r, 3) {
if (is_ok(wi, r, l)) {
chmin(ans, dp[0].sp[wi][l][r]);
} else {
chmin(ans, dp[0].sp[wi][l][r] + w.back());
}
}
return ans;
}
详细
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 1ms
memory: 3864kb
input:
5 0 452912 0 820899 0 79369 0 232463 1000000000000 1000000000000 1000000000000 1000000000000
output:
532281
result:
ok single line: '532281'
Test #2:
score: 6
Accepted
time: 1ms
memory: 3852kb
input:
6 0 581451 0 68556 0 918465 0 661406 0 41816 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000
output:
1000000110372
result:
ok single line: '1000000110372'
Test #3:
score: 6
Accepted
time: 0ms
memory: 3780kb
input:
4 0 0 0 0 0 0 0 0 0
output:
0
result:
ok single line: '0'
Test #4:
score: 6
Accepted
time: 1ms
memory: 3768kb
input:
5 0 938777585449 0 576051802364 0 418735407836 0 823692221300 233950071687 338912182863 866023804654 680391493800
output:
1333076973323
result:
ok single line: '1333076973323'
Test #5:
score: 6
Accepted
time: 1ms
memory: 3772kb
input:
6 0 938777585449 0 576051802364 0 418735407836 0 823692221300 0 233950071687 338912182863 866023804654 680391493800 876313612238 476765859230
output:
991597662386
result:
ok single line: '991597662386'
Test #6:
score: 6
Accepted
time: 16ms
memory: 29496kb
input:
99995 0 573954 1 101503 2 350026 3 832411 4 311022 5 583957 6 894954 7 223392 8 287704 9 259600 10 964702 11 24863 12 831166 13 754666 14 96743 15 606341 16 198920 17 262280 18 610409 19 193417 20 192417 21 194438 22 244016 23 680809 24 106449 25 249873 26 41805 27 375383 28 927874 29 148386 30 1354...
output:
3
result:
ok single line: '3'
Test #7:
score: 6
Accepted
time: 20ms
memory: 29340kb
input:
99995 0 573954 1 101503 2 350026 3 832411 4 311022 5 583957 6 894954 7 223392 8 287704 9 259600 10 964702 11 24863 12 831166 13 754666 14 96743 15 606341 16 198920 17 262280 18 610409 19 193417 20 192417 21 194438 22 244016 23 680809 24 106449 25 249873 26 41805 27 375383 28 927874 29 148386 30 1354...
output:
0
result:
ok single line: '0'
Test #8:
score: 6
Accepted
time: 17ms
memory: 29248kb
input:
99995 0 573954 1 101503 2 350026 3 832411 4 311022 5 583957 6 894954 7 223392 8 287704 9 259600 10 964702 11 24863 12 831166 13 754666 14 96743 15 606341 16 198920 17 262280 18 610409 19 193417 20 192417 21 194438 22 244016 23 680809 24 106449 25 249873 26 41805 27 375383 28 927874 29 148386 30 1354...
output:
3
result:
ok single line: '3'
Test #9:
score: 6
Accepted
time: 19ms
memory: 29252kb
input:
99995 0 573954 1 101503 2 350026 3 832411 4 311022 5 583957 6 894954 7 223392 8 287704 9 259600 10 964702 11 24863 12 831166 13 754666 14 96743 15 606341 16 198920 17 262280 18 610409 19 193417 20 192417 21 194438 22 244016 23 680809 24 106449 25 249873 26 41805 27 375383 28 927874 29 148386 30 1354...
output:
50
result:
ok single line: '50'
Test #10:
score: 6
Accepted
time: 1ms
memory: 3796kb
input:
7 0 1 1 1 0 1 0 1 4 1 0 1 1000000000000 1000000000000 1000000000000 1000000000000
output:
0
result:
ok single line: '0'
Test #11:
score: 6
Accepted
time: 20ms
memory: 29348kb
input:
99995 0 800351 1 590567 2 404564 3 601685 4 802526 5 784654 6 558749 7 760258 8 655714 9 864130 10 678664 11 983868 12 396629 13 637742 14 592018 15 810308 16 889529 17 914966 18 623197 19 97239 20 448357 21 67877 22 785864 23 177614 24 242659 25 301722 26 5175 27 418269 28 213547 29 417295 30 80595...
output:
1000000000000
result:
ok single line: '1000000000000'
Test #12:
score: 6
Accepted
time: 14ms
memory: 29336kb
input:
99995 0 800351 1 590567 2 404564 3 601685 4 802526 5 784654 6 558749 7 760258 8 655714 9 864130 10 678664 11 983868 12 396629 13 637742 14 592018 15 810308 16 889529 17 914966 18 623197 19 97239 20 448357 21 67877 22 785864 23 177614 24 242659 25 301722 26 5175 27 418269 28 213547 29 417295 30 80595...
output:
1000000000023
result:
ok single line: '1000000000023'
Test #13:
score: 6
Accepted
time: 8ms
memory: 29408kb
input:
99995 0 800351 1 590567 2 404564 3 601685 4 802526 5 784654 6 558749 7 760258 8 655714 9 864130 10 678664 11 983868 12 396629 13 637742 14 592018 15 810308 16 889529 17 914966 18 623197 19 97239 20 448357 21 67877 22 785864 23 177614 24 242659 25 301722 26 5175 27 418269 28 213547 29 417295 30 80595...
output:
1000000000000
result:
ok single line: '1000000000000'
Test #14:
score: 6
Accepted
time: 16ms
memory: 29464kb
input:
99995 0 800351 1 590567 2 404564 3 601685 4 802526 5 784654 6 558749 7 760258 8 655714 9 864130 10 678664 11 983868 12 396629 13 637742 14 592018 15 810308 16 889529 17 914966 18 623197 19 97239 20 448357 21 67877 22 785864 23 177614 24 242659 25 301722 26 5175 27 418269 28 213547 29 417295 30 80595...
output:
1000000000023
result:
ok single line: '1000000000023'
Test #15:
score: 6
Accepted
time: 17ms
memory: 29388kb
input:
99995 0 800351 1 590567 2 404564 3 601685 4 802526 5 784654 6 558749 7 760258 8 655714 9 864130 10 678664 11 983868 12 396629 13 637742 14 592018 15 810308 16 889529 17 914966 18 623197 19 97239 20 448357 21 67877 22 785864 23 177614 24 242659 25 301722 26 5175 27 418269 28 213547 29 417295 30 80595...
output:
23
result:
ok single line: '23'
Test #16:
score: 6
Accepted
time: 17ms
memory: 29304kb
input:
99995 0 800351 1 590567 2 404564 3 601685 4 802526 5 784654 6 558749 7 760258 8 655714 9 864130 10 678664 11 983868 12 396629 13 637742 14 592018 15 810308 16 889529 17 914966 18 623197 19 97239 20 448357 21 67877 22 785864 23 177614 24 242659 25 301722 26 5175 27 418269 28 213547 29 417295 30 80595...
output:
23
result:
ok single line: '23'
Test #17:
score: 6
Accepted
time: 22ms
memory: 29208kb
input:
99995 0 307516682495 1 677180705676 2 900093321878 3 855950595166 4 60373551204 5 97525179732 6 859433105930 7 470206852651 8 836315525302 9 68512632833 10 862923859868 11 74601760822 12 219027891391 13 839738396803 14 169708425659 15 592509244955 16 824764053219 17 619446917083 18 422190804040 19 8...
output:
3249113
result:
ok single line: '3249113'
Test #18:
score: 6
Accepted
time: 22ms
memory: 29268kb
input:
99995 0 307516682495 1 677180705676 2 900093321878 3 855950595166 4 60373551204 5 97525179732 6 859433105930 7 470206852651 8 836315525302 9 68512632833 10 862923859868 11 74601760822 12 219027891391 13 839738396803 14 169708425659 15 592509244955 16 824764053219 17 619446917083 18 422190804040 19 8...
output:
484857763484
result:
ok single line: '484857763484'
Test #19:
score: 6
Accepted
time: 22ms
memory: 29212kb
input:
99995 0 307516682495 1 677180705676 2 900093321878 3 855950595166 4 60373551204 5 97525179732 6 859433105930 7 470206852651 8 836315525302 9 68512632833 10 862923859868 11 74601760822 12 219027891391 13 839738396803 14 169708425659 15 592509244955 16 824764053219 17 619446917083 18 422190804040 19 8...
output:
0
result:
ok single line: '0'
Test #20:
score: 6
Accepted
time: 19ms
memory: 29284kb
input:
99995 0 307516682495 1 677180705676 2 900093321878 3 855950595166 4 60373551204 5 97525179732 6 859433105930 7 470206852651 8 836315525302 9 68512632833 10 862923859868 11 74601760822 12 219027891391 13 839738396803 14 169708425659 15 592509244955 16 824764053219 17 619446917083 18 422190804040 19 8...
output:
86963587131
result:
ok single line: '86963587131'
Test #21:
score: 6
Accepted
time: 23ms
memory: 29476kb
input:
99995 0 307516682495 1 677180705676 2 900093321878 3 855950595166 4 60373551204 5 97525179732 6 859433105930 7 470206852651 8 836315525302 9 68512632833 10 862923859868 11 74601760822 12 219027891391 13 839738396803 14 169708425659 15 592509244955 16 824764053219 17 619446917083 18 422190804040 19 8...
output:
3249113
result:
ok single line: '3249113'
Test #22:
score: 6
Accepted
time: 26ms
memory: 29408kb
input:
99995 0 307516682495 1 677180705676 2 900093321878 3 855950595166 4 60373551204 5 97525179732 6 859433105930 7 470206852651 8 836315525302 9 68512632833 10 862923859868 11 74601760822 12 219027891391 13 839738396803 14 169708425659 15 592509244955 16 824764053219 17 619446917083 18 422190804040 19 8...
output:
484861012597
result:
ok single line: '484861012597'
Test #23:
score: 6
Accepted
time: 18ms
memory: 29212kb
input:
99995 0 307516682495 1 677180705676 2 900093321878 3 855950595166 4 60373551204 5 97525179732 6 859433105930 7 470206852651 8 836315525302 9 68512632833 10 862923859868 11 74601760822 12 219027891391 13 839738396803 14 169708425659 15 592509244955 16 824764053219 17 619446917083 18 422190804040 19 8...
output:
72033520
result:
ok single line: '72033520'
Test #24:
score: 6
Accepted
time: 22ms
memory: 29268kb
input:
99995 0 307516682495 1 677180705676 2 900093321878 3 855950595166 4 60373551204 5 97525179732 6 859433105930 7 470206852651 8 836315525302 9 68512632833 10 862923859868 11 74601760822 12 219027891391 13 839738396803 14 169708425659 15 592509244955 16 824764053219 17 619446917083 18 422190804040 19 8...
output:
87023183814
result:
ok single line: '87023183814'
Test #25:
score: 6
Accepted
time: 19ms
memory: 29384kb
input:
99995 0 307516682495 1 677180705676 2 900093321878 3 855950595166 4 60373551204 5 97525179732 6 859433105930 7 470206852651 8 836315525302 9 68512632833 10 862923859868 11 74601760822 12 219027891391 13 839738396803 14 169708425659 15 592509244955 16 824764053219 17 619446917083 18 422190804040 19 8...
output:
3249113
result:
ok single line: '3249113'
Test #26:
score: 6
Accepted
time: 17ms
memory: 29212kb
input:
99995 0 307516682495 1 677180705676 2 900093321878 3 855950595166 4 60373551204 5 97525179732 6 859433105930 7 470206852651 8 836315525302 9 68512632833 10 862923859868 11 74601760822 12 219027891391 13 839738396803 14 169708425659 15 592509244955 16 824764053219 17 619446917083 18 422190804040 19 8...
output:
3249113
result:
ok single line: '3249113'
Test #27:
score: 6
Accepted
time: 0ms
memory: 3772kb
input:
4 0 9 0 8 0 0 9 9 9
output:
9
result:
ok single line: '9'
Subtask #2:
score: 0
Time Limit Exceeded
Test #28:
score: 0
Time Limit Exceeded
input:
99997 0 122727 0 267270 0 846212 0 454122 0 805668 0 614161 0 7805 0 173284 0 684707 0 269129 0 930945 0 1101 0 992427 0 297412 0 759787 0 227130 0 120418 0 90914 0 333684 0 46144 0 519912 0 171490 0 823586 0 121787 0 674177 0 560254 0 753090 0 853359 0 465464 0 655527 0 631303 0 919012 0 597126 0 1...
output:
result:
Subtask #3:
score: 0
Time Limit Exceeded
Test #36:
score: 5
Accepted
time: 1ms
memory: 3804kb
input:
11 0 9 0 8 2 0 3 7 3 1 2 6 0 0 7 7 7 1 9 6 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000
output:
1
result:
ok single line: '1'
Test #37:
score: 5
Accepted
time: 15ms
memory: 16528kb
input:
50311 0 630582 1 458618 2 300543 3 566041 4 306718 5 134260 6 736322 7 458543 8 609374 9 355623 10 706939 11 48588 12 455725 13 105118 14 71071 15 528699 16 423538 17 471781 18 98063 19 169099 20 657181 21 295537 22 49937 23 306612 24 186582 25 505763 26 831500 27 406268 28 294626 29 128111 30 42115...
output:
813491
result:
ok single line: '813491'
Test #38:
score: 5
Accepted
time: 544ms
memory: 29496kb
input:
99992 0 630582 0 458618 2 300543 2 566041 4 306718 4 134260 6 736322 6 458543 8 609374 8 355623 10 706939 10 48588 12 455725 12 105118 14 71071 14 528699 16 423538 16 471781 18 98063 18 169099 20 657181 20 295537 22 49937 22 306612 24 186582 24 505763 26 831500 26 406268 28 294626 28 128111 30 42115...
output:
0
result:
ok single line: '0'
Test #39:
score: 5
Accepted
time: 247ms
memory: 21736kb
input:
70338 0 630582 0 458618 2 300543 3 566041 4 306718 5 134260 5 736322 7 458543 8 609374 8 355623 10 706939 7 48588 12 455725 13 105118 14 71071 15 528699 16 423538 15 471781 18 98063 14 169099 20 657181 21 295537 22 49937 23 306612 21 186582 25 505763 26 831500 27 406268 27 294626 29 128111 30 421150...
output:
1645133792
result:
ok single line: '1645133792'
Test #40:
score: 5
Accepted
time: 255ms
memory: 23132kb
input:
75063 0 630582 1 458618 2 300543 3 566041 4 306718 5 134260 6 736322 7 458543 7 609374 9 355623 5 706939 11 48588 4 455725 13 105118 13 71071 15 528699 16 423538 17 471781 17 98063 19 169099 20 657181 21 295537 20 49937 23 306612 23 186582 25 505763 19 831500 27 406268 28 294626 28 128111 30 421150 ...
output:
2120124996
result:
ok single line: '2120124996'
Test #41:
score: 5
Accepted
time: 215ms
memory: 21976kb
input:
71756 0 630582 1 458618 0 300543 3 566041 4 306718 4 134260 6 736322 7 458543 8 609374 9 355623 10 706939 11 48588 12 455725 13 105118 14 71071 15 528699 16 423538 17 471781 18 98063 16 169099 20 657181 12 295537 22 49937 23 306612 24 186582 25 505763 26 831500 26 406268 28 294626 23 128111 30 42115...
output:
1787349034
result:
ok single line: '1787349034'
Test #42:
score: 5
Accepted
time: 203ms
memory: 21728kb
input:
70448 0 630582 1 458618 2 300543 3 566041 4 306718 5 134260 6 736322 7 458543 7 609374 9 355623 10 706939 11 48588 12 455725 13 105118 12 71071 15 528699 16 423538 17 471781 17 98063 19 169099 19 657181 21 295537 22 49937 23 306612 24 186582 16 505763 26 831500 27 406268 27 294626 29 128111 30 42115...
output:
1645924769
result:
ok single line: '1645924769'
Test #43:
score: 5
Accepted
time: 228ms
memory: 21116kb
input:
68356 0 630582 1 458618 2 300543 3 566041 4 306718 5 134260 6 736322 7 458543 8 609374 9 355623 10 706939 11 48588 12 455725 13 105118 14 71071 15 528699 16 423538 17 471781 18 98063 19 169099 20 657181 21 295537 22 49937 23 306612 24 186582 25 505763 26 831500 27 406268 28 294626 29 128111 30 42115...
output:
1434056469
result:
ok single line: '1434056469'
Test #44:
score: 5
Accepted
time: 30ms
memory: 29368kb
input:
99998 0 989885 1 623358 2 323898 3 418387 4 847431 5 998077 6 737652 7 214051 8 72927 9 817696 10 494815 11 349489 12 264272 13 60664 14 739563 15 744355 16 882267 17 957314 18 547277 19 714547 20 566081 21 593766 22 431363 23 249609 24 768570 25 985859 26 183057 27 840222 28 168478 29 16211 30 3082...
output:
2654008
result:
ok single line: '2654008'
Test #45:
score: 5
Accepted
time: 607ms
memory: 33952kb
input:
99997 0 955101 1 576100 2 127659 3 811226 4 41161 4 566231 6 943952 7 287921 8 995827 9 53909 10 446266 11 568843 12 813723 12 241044 12 619032 15 744341 15 255358 15 8997 18 425939 18 28355 20 747884 21 827659 21 772961 23 229078 24 638934 24 618689 24 795722 27 518058 28 691526 29 667781 30 259093...
output:
10977059663
result:
ok single line: '10977059663'
Test #46:
score: 5
Accepted
time: 451ms
memory: 29888kb
input:
99998 0 349154 0 960228 2 693946 3 247696 3 58262 5 799702 5 731306 7 501447 8 296672 8 812371 10 173737 10 91929 12 524275 12 13376 14 316834 14 77773 16 888284 17 491488 18 963488 19 57028 20 526164 21 289556 22 136189 22 471245 24 474182 24 398669 26 46490 27 40395 28 529585 29 627410 30 271602 3...
output:
4656503217
result:
ok single line: '4656503217'
Test #47:
score: 5
Accepted
time: 379ms
memory: 29600kb
input:
99998 0 989885 1 623358 0 323898 3 418387 4 847431 4 998077 6 737652 7 214051 8 72927 8 817696 10 494815 11 349489 11 264272 13 60664 13 739563 15 744355 16 882267 11 957314 18 547277 19 714547 20 566081 21 593766 21 431363 23 249609 24 768570 25 985859 26 183057 27 840222 28 168478 28 16211 26 3082...
output:
5211108945
result:
ok single line: '5211108945'
Test #48:
score: 5
Accepted
time: 531ms
memory: 29680kb
input:
99998 0 989885 1 623358 2 323898 1 418387 4 847431 4 998077 4 737652 1 214051 8 72927 9 817696 10 494815 11 349489 10 264272 10 60664 8 739563 8 744355 16 882267 17 957314 18 547277 19 714547 20 566081 20 593766 20 431363 18 249609 24 768570 25 985859 26 183057 25 840222 28 168478 28 16211 30 30820 ...
output:
7300156968
result:
ok single line: '7300156968'
Test #49:
score: 5
Accepted
time: 500ms
memory: 29528kb
input:
99999 0 960228 1 693946 1 247696 3 58262 3 799702 5 731306 5 501447 3 296672 8 812371 9 173737 10 91929 11 524275 12 13376 12 316834 11 77773 15 888284 15 491488 10 963488 18 57028 19 526164 19 289556 18 136189 22 471245 22 474182 9 398669 25 46490 26 40395 27 529585 28 627410 29 271602 30 109358 31...
output:
10004154233
result:
ok single line: '10004154233'
Test #50:
score: 0
Time Limit Exceeded
input:
99998 0 349154 1 960228 1 693946 1 247696 4 58262 5 799702 5 731306 5 501447 5 296672 5 812371 5 173737 5 91929 5 524275 5 13376 5 316834 4 77773 16 888284 16 491488 16 963488 16 57028 16 526164 16 289556 16 136189 16 471245 16 474182 16 398669 4 46490 27 40395 27 529585 27 627410 27 271602 27 10935...
output:
result:
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Wrong Answer
Test #77:
score: 0
Wrong Answer
time: 8ms
memory: 16528kb
input:
50311 0 962897543825 1 887020369743 2 363658802934 3 481009844166 4 1099712574 5 858320882162 6 521927434762 7 379344260539 8 73024776148 9 634183458545 10 869560347910 11 81581323331 12 750044298516 13 307013017409 14 306226274039 15 423923546601 16 482114694167 17 849292461119 18 299993045938 19 7...
output:
863002630752
result:
wrong answer 1st lines differ - expected: '939418184213', found: '863002630752'
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%