QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#533969#1490. Road Closuresotarius#7 22ms7308kbC++142.0kb2024-08-26 17:46:242024-08-26 17:46:25

Judging History

你现在查看的是最新测评结果

  • [2024-08-26 17:46:25]
  • 评测
  • 测评结果:7
  • 用时:22ms
  • 内存:7308kb
  • [2024-08-26 17:46:24]
  • 提交

answer

// #include "jumps.h"
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace __gnu_pbds;
using namespace std;

// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define ff first
#define sc second
#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define ull unsigned long long
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

// #define int long long
// #define int unsigned long long

// #define ordered_set(T) tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
// #define ordered_multiset(T) tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>

void open_file(string filename) {
    freopen((filename + ".in").c_str(), "r", stdin);
    freopen((filename + ".out").c_str(), "w", stdout);
}

// const ll mod = 1e9 + 7;
// const ll mod = 998244353;

const ll inf = 1e9;
const ll biginf = 1e18;
const int maxN = 2 * 1e5 + 25;

vector<ll> minimum_closure_costs(int n, vector<int> u, vector<int> v, vector<int> w) {
    vector<ll> ans(n, 0);
    ll dp[n + 1] = {}, sum = 0;
    for (int i = 0; i < n - 1; i ++) sum += w[i];
    dp[0] = w[0];
    dp[1] = max(w[0], w[1]);
    for (int i = 2; i < n - 1; i++)
        dp[i] = max(dp[i - 1], dp[i - 2] + w[i]);
    ans[0] = sum; ans[1] = sum - dp[n - 2];
    return ans;
}
// int main() {
//   int N;
//   assert(1 == scanf("%d", &N));

//   std::vector<int> U(N - 1), V(N - 1), W(N - 1);
//   for (int i = 0; i < N - 1; ++i) {
//     assert(3 == scanf("%d %d %d", &U[i], &V[i], &W[i]));
//   }

//   std::vector<long long> closure_costs = minimum_closure_costs(N, U, V, W);
//   for (int i = 0; i < static_cast<int>(closure_costs.size()); ++i) {
//     if (i > 0) {
//       printf(" ");
//     }
//     printf("%lld",closure_costs[i]);
//   }
//   printf("\n");
//   return 0;
// }

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3840kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
2000
0 559 717769868
0 237 766447943
0 122 517523402
0 1779 560381127
0 1477 566064983
0 67 303410673
0 1869 605544497
0 1769 774963386
0 457 469996896
0 201 995323973
0 1694 885366346
0 1547 362843462
0 55 947026157
0 1302 448837561
0 733 673028958
0 1139 65...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
1239932930636 574533067977 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

wrong answer 3rd lines differ - expected: '1239932930636 1238933034699 12...752918397 501659798 250746454 0', found: '1239932930636 574533067977 0 0...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'

Subtask #2:

score: 7
Accepted

Test #19:

score: 7
Accepted
time: 0ms
memory: 3768kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
2
0 1 4

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
4 0

result:

ok 3 lines

Test #20:

score: 7
Accepted
time: 14ms
memory: 6616kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
82978
0 1 687749865
1 2 811016969
2 3 502155590
3 4 930576294
4 5 879987412
5 6 883450944
6 7 975772046
7 8 739249697
8 9 954502114
9 10 962223056
10 11 562948742
11 12 933819577
12 13 614418299
13 14 724040317
14 15 798630312
15 16 583709944
16 17 634442427
...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
62302380746314 30279591664360 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #21:

score: 7
Accepted
time: 22ms
memory: 6912kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
93546
0 1 290395864
1 2 691792065
2 3 835413884
3 4 710017326
4 5 260033127
5 6 653931538
6 7 436315036
7 8 457880361
8 9 309935199
9 10 852772849
10 11 514034846
11 12 383007265
12 13 382658811
13 14 360592330
14 15 393423735
15 16 96114953
16 17 372806844
1...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
46896508581910 19411729586291 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #22:

score: 7
Accepted
time: 22ms
memory: 7240kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
100000
0 1 535716508
1 2 834689223
2 3 936888828
3 4 622366241
4 5 708605912
5 6 758421977
6 7 943752359
7 8 532568340
8 9 660522341
9 10 526589282
10 11 407223876
11 12 396491315
12 13 803568283
13 14 555205600
14 15 725646618
15 16 373592297
16 17 980551825...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
66701059031889 31442955862629 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #23:

score: 7
Accepted
time: 22ms
memory: 7044kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
100000
0 1 1000000000
1 2 1000000000
2 3 1000000000
3 4 1000000000
4 5 1000000000
5 6 1000000000
6 7 1000000000
7 8 1000000000
8 9 1000000000
9 10 1000000000
10 11 1000000000
11 12 1000000000
12 13 1000000000
13 14 1000000000
14 15 1000000000
15 16 1000000000...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
99999000000000 49999000000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #24:

score: 7
Accepted
time: 1ms
memory: 4112kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
1732
0 1 858069575
1 2 643017934
2 3 540485959
3 4 820000496
4 5 776986350
5 6 604493611
6 7 577636752
7 8 685510561
8 9 865040992
9 10 762236552
10 11 923488407
11 12 636650815
12 13 728034498
13 14 735002870
14 15 619256548
15 16 514085722
16 17 744134689
1...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
1299591209599 630022056918 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 3 lines

Test #25:

score: 7
Accepted
time: 0ms
memory: 4132kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
2000
0 1 309682260
1 2 582822719
2 3 372695773
3 4 255854267
4 5 992051341
5 6 355887755
6 7 910109803
7 8 568867708
8 9 869299390
9 10 650032264
10 11 371463568
11 12 786674220
12 13 304201693
13 14 855741258
14 15 806288832
15 16 633487600
16 17 633235427
1...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
1239764761863 562451883340 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 3 lines

Test #26:

score: 7
Accepted
time: 1ms
memory: 3856kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
1801
0 1 1000000000
1 2 1000000000
2 3 1000000000
3 4 1000000000
4 5 1000000000
5 6 1000000000
6 7 1000000000
7 8 1000000000
8 9 1000000000
9 10 1000000000
10 11 1000000000
11 12 1000000000
12 13 1000000000
13 14 1000000000
14 15 1000000000
15 16 1000000000
1...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
1800000000000 900000000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 3 lines

Test #27:

score: 7
Accepted
time: 0ms
memory: 4028kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
171
0 1 766172074
1 2 931210333
2 3 725812205
3 4 639092706
4 5 802029394
5 6 634444904
6 7 666167555
7 8 825997857
8 9 851226871
9 10 843589661
10 11 970684047
11 12 748794185
12 13 791747935
13 14 948683271
14 15 978918318
15 16 829093463
16 17 648684939
17...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
129209451152 62155967967 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 3 lines

Test #28:

score: 7
Accepted
time: 0ms
memory: 3772kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
191
0 1 729078100
1 2 767557971
2 3 180298865
3 4 114953486
4 5 191065394
5 6 940938196
6 7 610880461
7 8 328050996
8 9 183108344
9 10 726774422
10 11 212906788
11 12 321599678
12 13 408399561
13 14 306515309
14 15 992339932
15 16 500835110
16 17 744715358
17...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
91692922954 37294969453 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #29:

score: 7
Accepted
time: 0ms
memory: 3868kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
200
0 1 1000000000
1 2 1000000000
2 3 1000000000
3 4 1000000000
4 5 1000000000
5 6 1000000000
6 7 1000000000
7 8 1000000000
8 9 1000000000
9 10 1000000000
10 11 1000000000
11 12 1000000000
12 13 1000000000
13 14 1000000000
14 15 1000000000
15 16 1000000000
16...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
199000000000 99000000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 3 lines

Test #30:

score: 7
Accepted
time: 12ms
memory: 5532kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
59921
0 1 5
1 2 8
2 3 6
3 4 5
4 5 6
5 6 7
6 7 10
7 8 6
8 9 6
9 10 7
10 11 8
11 12 8
12 13 8
13 14 10
14 15 8
15 16 9
16 17 10
17 18 9
18 19 10
19 20 9
20 21 5
21 22 7
22 23 9
23 24 10
24 25 7
25 26 6
26 27 5
27 28 9
28 29 8
29 30 10
30 31 9
31 32 8
32 33 5
33...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
448845 215903 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #31:

score: 7
Accepted
time: 19ms
memory: 7248kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
100000
0 1 6
1 2 5
2 3 5
3 4 6
4 5 8
5 6 1
6 7 8
7 8 1
8 9 10
9 10 6
10 11 4
11 12 2
12 13 3
13 14 8
14 15 3
15 16 7
16 17 3
17 18 7
18 19 3
19 20 1
20 21 7
21 22 8
22 23 7
23 24 1
24 25 5
25 26 8
26 27 5
27 28 3
28 29 3
29 30 5
30 31 8
31 32 9
32 33 4
33 34 ...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
551723 235653 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #32:

score: 7
Accepted
time: 17ms
memory: 7036kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
90075
0 1 1
1 2 1
2 3 1
3 4 1
4 5 1
5 6 1
6 7 1
7 8 1
8 9 1
9 10 1
10 11 1
11 12 1
12 13 1
13 14 1
14 15 1
15 16 1
16 17 1
17 18 1
18 19 1
19 20 1
20 21 1
21 22 1
22 23 1
23 24 1
24 25 1
25 26 1
26 27 1
27 28 1
28 29 1
29 30 1
30 31 1
31 32 1
32 33 1
33 34 1
...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
90074 45037 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #33:

score: 7
Accepted
time: 19ms
memory: 7060kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
100000
0 1 1
1 2 1
2 3 1
3 4 1
4 5 1
5 6 1
6 7 1
7 8 1
8 9 1
9 10 1
10 11 1
11 12 1
12 13 1
13 14 1
14 15 1
15 16 1
16 17 1
17 18 1
18 19 1
19 20 1
20 21 1
21 22 1
22 23 1
23 24 1
24 25 1
25 26 1
26 27 1
27 28 1
28 29 1
29 30 1
30 31 1
31 32 1
32 33 1
33 34 1...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
99999 49999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Subtask #3:

score: 0
Wrong Answer

Test #34:

score: 14
Accepted
time: 0ms
memory: 3800kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
2
0 1 4

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
4 0

result:

ok 3 lines

Test #35:

score: 0
Wrong Answer
time: 0ms
memory: 3860kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
5
0 1 1
0 2 4
0 3 3
2 4 2

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
10 4 0 0 0

result:

wrong answer 3rd lines differ - expected: '10 5 1 0 0', found: '10 4 0 0 0'

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Wrong Answer

Test #79:

score: 0
Wrong Answer
time: 15ms
memory: 7308kb

input:

c10234cabdfd6eae47773fb6f163e0350fc797e1
96680
81008 32770 1
53103 75975 1
38090 49649 1
35805 25778 1
50058 68261 1
52213 58881 1
52672 34310 1
1080 42408 1
32306 82599 1
73623 7340 1
87691 42161 1
78365 96557 1
78654 88488 1
5875 25925 1
23217 85743 1
18698 42579 1
90401 84720 1
45973 91271 1
5282...

output:

064bde9ff69ddc34b3b45c2d26d58873d85290d3
OK
96679 48339 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

wrong answer 3rd lines differ - expected: '96679 54857 24550 8415 2125 38...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0', found: '96679 48339 0 0 0 0 0 0 0 0 0 ...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%