QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#242195 | #3053. Marching Course | vlp | AC ✓ | 214ms | 10784kb | C++17 | 4.9kb | 2023-11-07 00:48:54 | 2023-11-07 00:48:54 |
Judging History
answer
#include <bits/stdc++.h>
#include <list>
#define len(x) (int) x.size()
#define all(x) x.begin(), x.end()
#define ll long long
#define ull unsigned long long
#define ld long double
#define start time_t res1 = time(NULL)
#define finish \
time_t res2 = time(NULL); \
cerr << res2 - res1 << '\n'
const long long mod1 = 1e9 + 7;
const long long mod2 = 998244353;
const long long MAXLL = 9223372036854775807;
const long long MAXINT = 2147483647;
using namespace std;
void print(vector<pair<int, int>> a);
void print(vector<int> a);
void print(vector<vector<int>> a);
void print(vector<vector<char>> a);
void print(vector<char> a);
// #define mtask
#define int ll
void solve(){
int n, m, p;
cin >> n >> m >> p;
if(m > 5000) {
vector<vector<vector<ld>>> g;
vector<vector<ld>> dist;
g.resize(n);
dist.resize(n, vector<ld>(p + 1, -1e9));
dist[0][0] = 0;
for (int i = 0; i < m; ++i) {
ld u, v, d, s;
cin >> u >> v >> d >> s;
--u, --v;
g[(int) u].push_back({v, d, s});
g[(int) v].push_back({u, d, s});
}
for (int i = 0; i < n; ++i) {
ld mmax = 0;
for (auto x: g[i]) mmax = max(mmax, (ld) x[2] / (ld) x[1]);
g[i].push_back({(ld) i, 1, mmax});
}
vector<pair<int, int>> bfs(n, {1e9, 0});
bfs[0] = {0, 0};
set<pair<int, int>> q;
q.insert({0, 0});
while (len(q)) {
auto [d, cur] = *q.begin();
q.erase(q.begin());
for (auto x: g[cur]) {
if (bfs[x[0]].first > bfs[cur].first + x[1]) {
bfs[x[0]].first = d + x[1];
bfs[x[0]].second = bfs[cur].second + x[2];
q.insert({bfs[x[0]].first, x[0]});
} else if (bfs[x[0]].first == bfs[cur].first + x[1] && bfs[x[0]].second < bfs[cur].second + x[2]) {
bfs[x[0]].first = d + x[1];
bfs[x[0]].second = bfs[cur].second + x[2];
q.insert({bfs[x[0]].first, x[0]});
}
}
}
ld mmax = 0;
//print(bfs);
for (int cur = 0; cur < n; ++cur) {
for (auto x: g[cur]) {
int ind = cur;
if (bfs[cur].first > bfs[x[0]].first) {
ind = x[0];
} else if (bfs[cur].first == bfs[x[0]].first && bfs[cur].second < bfs[x[0]].second) ind = x[0];
if (2 * bfs[ind].first > p) continue;
ld cur = (p - 2 * bfs[ind].first) * x[2] / x[1];
mmax = max(mmax, cur + 2 * bfs[ind].second);
}
}
cout << mmax << '\n';
}
else{
vector<vector<vector<ld>>> g;
vector<vector<ld>> dist;
g.resize(n);
dist.resize(n, vector<ld>(p + 1, -1e9));
dist[0][0] = 0;
for(int i = 0; i < m; ++i){
ld u, v, d, s;
cin >> u >> v >> d >> s;
--u, --v;
g[(int)u].push_back({v, d, s});
g[(int)v].push_back({u, d, s});
}
for(int i = 0; i < n; ++i){
ld mmax = 0;
for(auto x : g[i]) mmax = max(mmax, (ld)x[2] / (ld)x[1]);
g[i].push_back({(ld)i, 1, mmax});
}
for(int T = 0; T < p; ++T) {
for(int cur = 0; cur < n; ++cur){
for (auto x: g[cur]) {
int newT = T + x[1];
if (newT > p) continue;
if (dist[(int) x[0]][newT] < dist[cur][T] + (ld) x[2]) {
dist[(int) x[0]][newT] = dist[cur][T] + (ld) x[2];
}
}
}
}
cout << dist[0][p] << '\n';
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.precision(40);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
#ifdef mtask
int t;
cin >> t;
while (t--)
#endif
solve();
}
void print(vector<pair<int, int>> a) {
for (int i = 0; i < len(a); ++i) {
cout << a[i].first << ' ' << a[i].second << '\n';
}
}
void print(vector<int> a) {
for (int i = 0; i < len(a); ++i) {
cout << a[i] << ' ';
}
cout << '\n';
}
void print(vector<vector<int>> a) {
for (int i = 0; i < len(a); ++i) {
print(a[i]);
}
}
void print(vector<char> a) {
for (int i = 0; i < len(a); ++i) {
cout << a[i];
}
cout << '\n';
}
#ifndef int
void print(vector<ll> a) {
for (int i = 0; i < len(a); ++i) {
cout << a[i] << ' ';
}
cout << '\n';
}
#endif
void print(vector<vector<char> > a) {
for (int i = 0; i < len(a); ++i) {
print(a[i]);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4040kb
input:
3 3 4 1 2 1 1 2 3 2 4 3 1 1 1
output:
6
result:
ok - 1 values
Test #2:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
4 3 9 1 2 2 1 1 3 2 2 1 4 2 3
output:
13.5
result:
ok - 1 values
Test #3:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
4 3 5 1 2 10 1 2 3 2 100 1 4 3 10
output:
16.66666666666666666608842550800773096853
result:
ok - 1 values
Test #4:
score: 0
Accepted
time: 0ms
memory: 4032kb
input:
3 3 10 1 2 3 1 1 3 4 5 2 3 2 10
output:
22
result:
ok - 1 values
Test #5:
score: 0
Accepted
time: 45ms
memory: 4508kb
input:
65 2080 409 30 37 338 348 10 15 132 14 7 32 215 699 17 62 36 468 5 43 294 92 7 22 426 281 24 48 180 532 54 59 289 784 8 65 12 48 14 63 368 647 29 36 32 46 16 35 233 396 2 54 2 336 22 36 431 890 35 48 367 897 35 45 326 995 9 35 398 464 28 57 442 976 22 47 437 893 3 7 273 711 37 60 217 765 33 49 424 7...
output:
330695
result:
ok - 1 values
Test #6:
score: 0
Accepted
time: 17ms
memory: 9116kb
input:
183 16653 688 87 158 526 44 135 148 214 291 85 138 454 863 86 142 582 489 125 147 702 90 47 127 67 766 96 153 553 255 53 68 441 14 167 175 455 341 29 123 43 771 82 152 49 645 74 100 697 226 154 157 256 454 78 146 467 17 33 119 101 419 100 168 409 300 58 171 515 256 48 166 475 973 49 83 102 885 36 52...
output:
653768
result:
ok - 1 values
Test #7:
score: 0
Accepted
time: 3ms
memory: 5840kb
input:
124 7626 363 19 60 28 989 79 117 14 671 68 84 242 953 98 112 161 310 6 99 168 431 12 69 287 286 19 57 330 955 39 54 258 243 64 94 260 179 9 61 125 254 16 19 211 422 20 108 22 903 14 77 97 584 75 111 358 37 63 102 341 53 16 29 104 232 35 94 331 846 105 106 158 682 41 54 42 328 75 109 352 422 5 103 19...
output:
329925
result:
ok - 1 values
Test #8:
score: 0
Accepted
time: 8ms
memory: 8856kb
input:
176 15400 718 8 166 138 728 19 62 687 839 40 120 703 359 58 102 138 867 19 171 601 623 107 156 638 396 92 171 65 156 132 144 613 858 150 175 19 515 13 158 479 562 72 170 63 520 55 73 63 865 4 131 8 393 91 146 408 604 128 137 616 234 28 172 409 42 111 173 684 522 39 166 494 644 63 141 68 8 82 117 251...
output:
651238
result:
ok - 1 values
Test #9:
score: 0
Accepted
time: 88ms
memory: 5140kb
input:
69 2346 775 8 47 41 822 61 67 24 865 4 51 683 8 44 58 391 232 18 61 518 125 17 29 123 746 38 58 103 557 39 59 734 484 38 45 68 699 14 24 316 33 3 43 542 903 13 61 786 319 11 35 132 303 7 33 666 748 16 69 252 373 3 37 539 172 14 41 643 461 15 45 540 271 3 31 175 417 47 60 500 836 52 58 609 524 49 69 ...
output:
374325
result:
ok - 1 values
Test #10:
score: 0
Accepted
time: 17ms
memory: 10064kb
input:
200 19900 710 40 61 574 538 90 181 354 374 1 148 536 286 79 159 238 203 119 156 1 52 88 190 232 89 146 193 274 71 133 167 324 413 4 96 733 328 26 159 654 372 184 192 486 674 75 189 243 751 137 147 733 11 68 71 102 239 38 111 262 146 91 162 353 6 26 120 563 193 82 159 270 66 32 106 730 634 46 180 611...
output:
656650
result:
ok - 1 values
Test #11:
score: 0
Accepted
time: 20ms
memory: 8544kb
input:
200 19900 282 9 165 10 656 82 88 293 921 84 95 250 407 2 61 86 884 53 182 57 978 31 191 65 26 17 29 4 571 14 143 176 126 67 193 29 927 83 184 14 20 103 121 125 926 94 128 128 671 94 104 226 90 47 119 31 750 101 166 289 889 24 102 146 662 68 121 29 234 32 168 136 118 48 175 62 288 85 157 127 693 72 1...
output:
262038
result:
ok - 1 values
Test #12:
score: 0
Accepted
time: 12ms
memory: 10784kb
input:
200 19900 985 52 92 473 209 74 175 858 879 70 183 234 750 57 137 266 314 33 67 115 190 86 191 186 243 86 160 351 772 25 96 891 974 142 192 116 938 23 184 531 758 106 199 629 809 154 185 775 971 6 129 759 79 115 157 147 98 28 165 932 593 9 156 957 503 10 152 722 370 73 131 117 132 78 177 192 410 72 1...
output:
850080
result:
ok - 1 values
Test #13:
score: 0
Accepted
time: 15ms
memory: 8516kb
input:
200 19900 252 31 107 214 15 103 107 169 488 47 176 238 714 8 35 139 71 49 75 125 334 12 41 141 675 102 162 130 775 62 88 152 769 124 198 237 686 29 80 51 113 28 91 156 183 78 124 1 785 19 181 4 919 59 113 85 818 80 137 202 72 45 144 107 179 46 80 36 961 18 19 201 13 14 134 218 452 36 108 83 807 42 1...
output:
232920
result:
ok - 1 values
Test #14:
score: 0
Accepted
time: 20ms
memory: 8272kb
input:
200 19900 231 93 117 160 925 178 188 1 87 11 110 238 725 14 75 173 225 73 194 24 710 12 137 186 475 99 182 5 595 24 93 8 55 29 176 116 982 156 182 245 844 56 176 150 49 72 86 93 978 168 172 39 133 15 80 66 357 190 193 75 924 109 187 24 853 21 185 240 976 14 65 145 162 58 125 230 75 79 177 189 310 73...
output:
219056
result:
ok - 1 values
Test #15:
score: 0
Accepted
time: 2ms
memory: 4368kb
input:
24 134 820 14 19 193 915 16 18 333 685 4 12 180 21 7 15 250 503 7 23 414 992 7 20 755 750 8 18 791 427 6 7 882 630 3 24 851 663 15 16 639 831 11 21 200 792 6 14 270 606 10 15 7 323 7 10 426 385 3 6 711 481 4 18 189 735 1 6 483 420 15 17 522 855 6 13 814 173 2 10 738 177 1 12 470 175 9 18 178 611 1 8...
output:
14451.14285714285718498217647720593959093
result:
ok - 1 values
Test #16:
score: 0
Accepted
time: 3ms
memory: 6500kb
input:
173 7521 340 59 149 129 898 12 91 208 987 6 32 334 460 138 173 279 514 64 150 307 150 84 134 168 231 88 153 325 713 73 131 139 504 17 53 259 579 136 148 158 415 60 138 5 138 36 154 102 631 3 109 228 372 42 73 131 229 108 151 164 978 18 49 295 753 67 123 193 756 27 75 198 975 7 171 99 70 9 10 121 445...
output:
251072
result:
ok - 1 values
Test #17:
score: 0
Accepted
time: 24ms
memory: 4524kb
input:
68 1125 423 6 57 432 813 6 21 188 184 30 37 305 159 13 22 205 949 7 51 22 192 7 47 166 717 24 32 197 934 11 65 333 27 41 46 235 196 23 32 56 936 37 49 166 628 45 50 69 43 52 67 324 561 9 13 460 601 51 66 120 845 9 66 211 66 53 66 48 210 40 62 280 194 42 51 123 358 30 45 91 922 2 13 247 419 32 50 128...
output:
278564
result:
ok - 1 values
Test #18:
score: 0
Accepted
time: 214ms
memory: 6380kb
input:
134 4471 834 1 127 20 325 37 50 658 472 14 54 55 506 48 94 215 572 21 123 95 104 74 91 670 685 20 34 81 261 30 77 309 283 57 90 571 380 2 66 787 503 46 71 427 397 63 127 150 82 11 131 337 425 40 78 834 210 67 103 492 787 9 95 91 202 59 112 770 229 86 119 636 706 43 132 55 907 28 88 687 327 73 88 471...
output:
678182
result:
ok - 1 values
Test #19:
score: 0
Accepted
time: 1ms
memory: 3988kb
input:
13 40 263 9 12 225 706 5 10 164 566 4 8 74 46 2 8 274 350 5 8 35 410 1 2 32 967 2 7 226 738 1 8 245 102 1 7 258 160 7 10 107 221 6 11 248 739 2 3 205 948 4 12 224 102 1 5 100 114 12 13 40 408 10 13 70 798 3 5 282 705 3 8 161 20 3 11 1 665 9 11 26 276 9 10 56 419 5 11 37 11 6 12 111 926 2 9 276 130 5...
output:
7947.53125
result:
ok - 1 values
Test #20:
score: 0
Accepted
time: 11ms
memory: 8388kb
input:
200 9846 827 26 89 765 792 101 109 608 165 93 162 55 596 114 149 59 548 146 166 874 558 50 82 304 765 31 152 697 964 41 125 442 681 14 111 255 43 12 71 807 329 131 194 485 605 27 96 213 263 141 144 467 152 20 34 459 650 116 119 243 615 24 90 708 650 170 196 776 323 5 53 850 484 9 117 375 50 49 111 2...
output:
629919
result:
ok - 1 values
Test #21:
score: 0
Accepted
time: 7ms
memory: 7492kb
input:
200 9881 541 24 97 384 311 66 71 473 72 14 121 73 258 150 174 446 3 101 165 485 893 14 169 41 784 45 78 537 551 87 115 245 872 43 194 506 136 122 179 36 509 16 147 368 724 12 29 10 723 3 118 545 323 27 57 522 586 36 61 377 876 79 195 569 278 65 72 227 191 25 73 438 317 35 39 554 441 85 94 218 880 6 ...
output:
413298
result:
ok - 1 values
Test #22:
score: 0
Accepted
time: 10ms
memory: 7668kb
input:
200 10026 598 13 60 226 535 63 141 377 720 68 169 294 717 46 59 411 583 4 200 125 228 103 197 16 246 175 198 481 909 62 195 224 182 140 190 622 854 108 171 33 174 125 133 499 221 86 180 524 665 72 183 353 129 104 134 409 462 17 37 558 247 149 196 596 996 124 132 162 257 113 174 91 270 136 167 207 93...
output:
508968
result:
ok - 1 values
Test #23:
score: 0
Accepted
time: 7ms
memory: 8972kb
input:
200 9989 956 27 119 458 525 47 95 889 200 7 125 970 595 170 187 159 16 97 182 657 407 64 182 953 394 130 145 343 199 33 112 530 830 19 155 639 394 120 141 957 128 39 125 174 610 31 189 598 248 23 25 741 163 9 90 608 50 97 142 628 207 61 181 216 733 105 118 725 742 59 124 850 626 121 126 307 646 41 1...
output:
757040
result:
ok - 1 values
Test #24:
score: 0
Accepted
time: 10ms
memory: 8844kb
input:
200 9954 947 99 128 744 545 19 116 960 440 38 69 575 164 135 167 102 315 28 120 415 121 62 185 616 359 79 143 597 879 44 165 582 427 80 158 283 860 76 197 868 363 74 96 918 162 8 135 48 571 90 200 236 873 89 139 851 403 56 193 561 815 127 149 433 60 130 194 314 918 22 157 931 980 84 104 483 650 95 1...
output:
807222
result:
ok - 1 values
Test #25:
score: 0
Accepted
time: 2ms
memory: 4128kb
input:
24 49 573 3 19 199 934 5 20 570 451 10 19 10 814 16 7 319 216 24 16 287 962 22 4 459 250 22 6 588 188 9 18 177 216 2 23 621 166 1 22 626 995 10 9 336 37 19 9 108 404 10 18 364 495 5 3 399 586 2 16 415 934 8 7 20 43 23 6 251 783 11 12 299 265 5 19 541 943 17 20 217 34 9 15 417 834 18 7 196 16 8 23 53...
output:
1323.662011173184350876219639303599251434
result:
ok - 1 values
Test #26:
score: 0
Accepted
time: 16ms
memory: 5716kb
input:
163 398 703 52 50 474 273 41 78 154 806 6 20 394 228 23 76 673 192 87 1 238 693 75 133 302 926 124 9 167 540 112 68 710 164 6 60 473 202 27 135 729 254 126 54 346 745 59 30 308 894 157 38 667 356 45 105 402 345 146 47 266 168 2 40 575 242 97 121 471 470 109 105 625 112 104 146 227 842 49 156 139 667...
output:
3388.96031746031747555747415390214882791
result:
ok - 1 values
Test #27:
score: 0
Accepted
time: 8ms
memory: 5600kb
input:
200 199 548 1 69 305 356 1 71 548 483 1 152 146 43 1 200 100 366 1 182 175 587 1 171 13 489 1 103 419 983 1 133 78 927 1 192 314 942 1 18 567 258 1 127 176 213 1 156 92 215 1 20 122 641 1 28 119 728 1 25 199 233 1 76 358 210 1 195 323 73 1 70 19 101 1 23 41 462 1 4 132 53 1 170 517 717 1 27 558 854 ...
output:
111244
result:
ok - 1 values
Test #28:
score: 0
Accepted
time: 5ms
memory: 5060kb
input:
200 199 321 1 170 192 605 1 52 340 322 1 21 72 318 1 139 92 49 1 164 96 371 1 48 49 255 1 8 127 470 1 172 221 252 1 199 34 478 1 75 152 856 1 41 59 960 1 116 102 116 1 91 195 361 1 125 304 655 1 120 246 384 1 176 197 714 1 166 125 889 1 78 65 918 1 79 323 381 1 67 29 810 1 193 105 307 1 179 84 188 1...
output:
54891
result:
ok - 1 values
Test #29:
score: 0
Accepted
time: 15ms
memory: 8324kb
input:
200 19900 209 33 145 519 995 57 105 519 995 168 198 519 995 153 169 519 995 83 141 519 995 163 189 519 995 40 74 519 995 96 111 519 995 147 148 519 995 12 161 519 995 39 103 519 995 185 190 519 995 5 75 519 995 42 114 519 995 30 119 519 995 44 82 519 995 28 117 519 995 9 123 519 995 136 193 519 995 ...
output:
400.6840077071290944221715335515909828246
result:
ok - 1 values
Test #30:
score: 0
Accepted
time: 11ms
memory: 8000kb
input:
200 19900 96 49 109 700 837 94 105 700 837 126 200 700 837 33 61 700 837 75 132 700 837 106 127 700 837 176 199 700 837 55 58 700 837 169 172 700 837 25 169 700 837 30 83 700 837 91 184 700 837 17 143 700 837 63 128 700 837 45 107 700 837 36 110 700 837 13 177 700 837 24 90 700 837 5 156 700 837 18 ...
output:
114.7885714285714285759487651716881373432
result:
ok - 1 values
Test #31:
score: 0
Accepted
time: 34ms
memory: 4668kb
input:
42 861 778 7 8 22 994 2 15 26 995 15 41 20 997 16 27 25 995 16 35 23 990 14 28 22 999 1 19 25 999 13 33 18 1000 31 36 21 992 19 26 24 997 20 23 22 995 6 39 22 1000 30 37 25 991 2 33 16 996 28 38 21 999 6 13 21 997 22 27 21 990 35 37 17 1000 14 39 21 993 28 30 16 991 5 23 23 998 12 22 17 999 16 34 26...
output:
48625
result:
ok - 1 values
Test #32:
score: 0
Accepted
time: 11ms
memory: 7840kb
input:
161 12880 507 52 59 39 671 80 149 38 667 97 129 47 668 53 92 41 671 51 126 43 675 1 83 46 670 7 48 37 675 37 154 46 671 14 28 46 673 131 159 47 675 32 73 43 672 99 127 47 668 32 64 39 670 120 135 42 666 49 62 38 668 48 154 41 672 78 88 42 671 5 24 37 676 12 112 39 674 10 67 41 676 30 130 38 673 12 9...
output:
9263.02702702702702719506078210542909801
result:
ok - 1 values
Test #33:
score: 0
Accepted
time: 8ms
memory: 4348kb
input:
53 267 584 9 48 1 7 5 30 2 10 16 4 3 3 6 37 1 7 41 42 2 9 49 37 1 7 29 23 1 6 5 50 1 10 24 28 1 7 52 44 2 1 32 41 1 10 33 22 3 1 25 27 2 6 30 14 2 11 15 51 2 10 32 45 1 6 25 9 1 11 32 11 1 7 45 11 2 8 26 8 3 3 16 26 3 2 26 4 2 2 43 45 2 6 40 39 3 3 37 27 1 6 40 4 2 3 52 19 2 1 44 16 2 2 34 36 3 2 37...
output:
564022
result:
ok - 1 values
Test #34:
score: 0
Accepted
time: 54ms
memory: 6852kb
input:
190 1089 946 154 120 2 1 41 63 2 10 62 13 1 8 20 39 2 8 111 44 2 10 140 133 2 8 28 176 1 10 7 73 1 9 31 187 2 2 38 139 2 3 42 186 2 10 138 101 2 2 159 85 2 8 120 89 3 3 112 14 1 7 41 37 1 11 25 120 3 1 88 117 2 8 108 68 1 6 66 115 2 11 167 129 2 11 7 135 2 6 165 107 1 6 157 9 2 3 180 159 2 6 77 110 ...
output:
906036
result:
ok - 1 values
Test #35:
score: 0
Accepted
time: 44ms
memory: 6268kb
input:
162 921 837 27 143 2 3 155 127 2 11 53 144 2 1 122 49 3 2 85 49 3 2 141 152 2 2 108 156 2 3 54 102 2 7 34 10 2 10 22 79 2 10 138 35 3 3 106 161 2 6 127 48 2 11 110 2 2 11 18 90 2 7 33 39 2 10 123 20 2 1 21 144 3 1 105 33 2 9 105 161 1 9 10 22 1 10 124 128 3 1 154 17 2 1 107 58 3 1 16 103 2 9 61 132 ...
output:
765064
result:
ok - 1 values
Test #36:
score: 0
Accepted
time: 13ms
memory: 4764kb
input:
104 573 406 102 37 1 9 56 31 3 3 93 67 3 3 79 90 1 7 24 90 2 11 57 99 2 9 38 87 1 11 31 49 2 3 63 50 2 8 6 45 1 10 90 85 2 11 13 99 1 11 22 67 3 3 8 20 2 6 76 95 1 9 65 24 2 11 36 102 1 10 47 54 2 9 75 18 1 9 68 72 1 8 56 91 2 2 85 32 2 11 58 3 2 3 81 83 2 6 19 58 2 3 38 70 2 9 53 25 3 2 44 51 2 9 1...
output:
382018
result:
ok - 1 values
Test #37:
score: 0
Accepted
time: 15ms
memory: 4680kb
input:
82 441 649 6 15 1 11 37 27 2 9 53 29 3 2 6 57 2 10 36 22 2 3 25 45 1 6 72 69 2 2 46 19 3 3 23 20 2 11 17 16 2 3 70 26 2 1 13 25 1 10 59 35 2 2 73 38 2 9 68 48 1 7 44 45 1 6 72 36 3 2 55 33 3 2 62 32 1 9 65 10 1 10 29 16 3 3 65 37 1 6 25 32 2 6 76 77 2 10 53 64 3 2 55 4 3 3 42 19 3 1 54 15 1 9 17 26 ...
output:
619030
result:
ok - 1 values
Test #38:
score: 0
Accepted
time: 104ms
memory: 7044kb
input:
200 2607 833 10 51 8 4 167 169 12 1 63 13 9 3 117 177 11 3 149 132 8 4 186 81 1 15 110 56 8 5 154 184 9 2 55 46 6 11 71 96 3 9 15 96 3 16 198 72 6 11 111 142 6 9 4 14 7 5 75 13 10 3 123 160 3 13 173 200 7 6 51 133 10 4 139 138 13 1 64 31 2 16 22 172 3 11 185 184 11 3 187 130 9 4 128 102 14 1 19 143 ...
output:
613547
result:
ok - 1 values
Test #39:
score: 0
Accepted
time: 100ms
memory: 7080kb
input:
200 2607 840 73 2 3 12 94 108 3 11 7 138 2 17 4 77 11 1 138 15 2 13 51 70 14 1 31 185 14 1 126 188 13 1 20 175 6 11 123 195 2 18 36 94 3 9 84 62 8 4 54 91 6 13 96 200 9 4 48 20 4 14 68 46 9 2 70 16 15 1 112 63 7 6 181 98 4 9 11 6 13 1 104 20 3 11 182 75 8 5 9 99 8 5 177 187 6 7 19 58 6 6 155 103 11 ...
output:
626064
result:
ok - 1 values
Test #40:
score: 0
Accepted
time: 96ms
memory: 7092kb
input:
200 2607 810 56 22 11 1 172 120 13 1 97 33 10 1 6 41 11 1 104 198 1 12 4 164 8 4 64 149 10 3 161 65 12 1 155 73 7 6 76 142 3 8 56 115 11 1 24 154 4 7 49 9 10 3 112 11 2 17 197 39 7 6 76 36 5 8 119 51 7 5 38 20 7 11 153 135 1 13 122 32 7 6 136 56 12 1 90 88 12 1 2 159 11 3 147 125 5 6 34 17 7 5 96 11...
output:
594322
result:
ok - 1 values
Test #41:
score: 0
Accepted
time: 93ms
memory: 6804kb
input:
200 2607 783 103 52 1 11 39 11 11 3 144 15 4 15 178 96 3 10 187 162 12 1 27 51 12 1 92 23 6 8 18 88 2 14 3 99 3 16 143 55 14 1 39 138 10 3 142 81 13 1 151 108 13 1 142 162 12 1 108 105 14 1 126 100 15 1 185 70 13 1 60 181 5 11 103 112 1 11 181 89 4 9 51 185 12 1 140 192 10 2 20 169 5 10 147 154 10 4...
output:
572884
result:
ok - 1 values
Test #42:
score: 0
Accepted
time: 66ms
memory: 6240kb
input:
200 2607 561 49 133 11 1 107 194 5 8 44 131 9 2 179 91 7 7 175 178 5 10 193 105 7 8 173 149 10 4 84 29 1 19 21 101 13 1 34 98 4 12 67 20 12 1 74 102 5 9 65 121 6 9 125 60 3 13 59 162 2 12 160 93 6 5 13 169 5 10 64 143 10 5 72 152 14 1 200 39 5 12 48 186 13 1 99 135 12 1 1 23 3 16 129 33 6 8 40 143 8...
output:
339540
result:
ok - 1 values
Test #43:
score: 0
Accepted
time: 48ms
memory: 6232kb
input:
200 1317 635 79 17 3 1 70 100 9 1 47 130 8 1 47 140 12 1 117 162 9 1 132 51 1 15 90 5 3 10 47 119 9 1 4 73 1 12 49 179 4 5 41 149 1 1 140 40 13 1 32 26 1 11 188 51 1 13 79 140 10 1 65 200 12 1 135 98 7 1 1 169 1 12 57 180 1 15 177 55 5 1 92 48 8 3 140 17 13 1 197 198 7 1 95 153 4 6 24 106 6 4 139 91...
output:
447032
result:
ok - 1 values
Test #44:
score: 0
Accepted
time: 27ms
memory: 5508kb
input:
200 1317 398 165 145 2 1 58 96 1 4 194 23 1 6 1 62 1 15 43 81 9 1 25 140 4 6 119 12 5 1 103 93 8 3 17 25 5 7 72 200 3 10 23 105 3 9 179 19 5 3 26 25 4 7 22 192 5 5 154 135 10 1 190 180 8 1 94 88 9 1 49 59 2 13 169 167 11 1 31 173 9 1 109 162 8 1 188 175 5 6 122 25 2 11 43 184 5 1 157 88 10 1 194 144...
output:
214032
result:
ok - 1 values
Test #45:
score: 0
Accepted
time: 62ms
memory: 6776kb
input:
200 1317 864 98 129 1 1 21 97 7 3 60 196 2 12 48 118 2 5 164 191 1 9 163 41 2 8 189 42 2 1 112 183 9 1 56 166 1 1 189 72 2 1 180 26 7 5 29 75 3 7 183 42 8 1 178 17 4 6 5 35 6 4 43 158 1 13 63 64 2 5 116 173 2 9 104 29 6 1 104 62 3 8 112 165 7 1 38 61 1 10 140 114 7 5 85 129 3 1 64 23 2 4 152 168 8 1...
output:
678036
result:
ok - 1 values
Test #46:
score: 0
Accepted
time: 36ms
memory: 5536kb
input:
200 1317 459 47 151 4 7 176 151 1 13 36 40 2 11 41 61 4 3 145 189 1 10 73 82 11 1 145 36 1 11 141 155 9 2 7 101 2 13 54 136 9 1 137 77 7 1 119 130 1 12 132 150 10 1 50 62 6 1 60 189 4 8 157 54 9 1 182 44 5 1 78 2 3 4 136 15 10 1 153 60 3 7 76 118 8 1 92 156 2 3 90 2 6 5 89 39 2 8 135 6 3 14 52 195 3...
output:
269030
result:
ok - 1 values
Test #47:
score: 0
Accepted
time: 19ms
memory: 4768kb
input:
200 1317 235 166 161 3 1 151 154 3 6 102 147 1 10 35 134 1 19 68 99 6 1 156 30 2 8 124 100 6 4 94 160 9 1 1 63 6 1 69 9 1 5 89 130 1 1 167 183 2 1 77 49 2 9 11 198 2 14 176 72 3 10 175 112 2 10 186 87 1 18 119 154 6 9 2 179 11 1 92 144 2 8 124 66 4 5 29 85 11 1 131 165 7 1 189 101 1 11 155 185 10 1 ...
output:
47030
result:
ok - 1 values
Test #48:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 1 1 1 2 1000 1
output:
0.0009999999999999999999584953855845392833857
result:
ok - 1 values
Test #49:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
2 1 1000 1 2 1 1000
output:
1000000
result:
ok - 1 values
Test #50:
score: 0
Accepted
time: 1ms
memory: 3992kb
input:
3 2 1000 1 2 900 1 2 3 1 1000
output:
1.111111111111111110255796063928102057616
result:
ok - 1 values
Test #51:
score: 0
Accepted
time: 1ms
memory: 4120kb
input:
5 5 1000 1 2 1 1 1 3 1 1 2 4 1 1 3 4 2 5 4 5 2 6
output:
2994
result:
ok - 1 values
Test #52:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
5 5 1000 1 2 10 10 1 3 10 10 2 4 10 12 3 4 9 10 4 5 1 1000
output:
962040
result:
ok - 1 values