Task: | Dispatching |
Sender: | jarvenp |
Submission time: | 2019-03-16 13:09:46 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.02 s | 1, 2 | details |
#2 | WRONG ANSWER | 0.01 s | 1, 2 | details |
#3 | WRONG ANSWER | 0.01 s | 1, 2 | details |
#4 | WRONG ANSWER | 0.01 s | 1, 2 | details |
#5 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#6 | ACCEPTED | 0.02 s | 1, 2 | details |
#7 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#8 | WRONG ANSWER | 0.01 s | 1, 2 | details |
#9 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#10 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#11 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#12 | WRONG ANSWER | 0.01 s | 1, 2 | details |
#13 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#14 | WRONG ANSWER | 0.01 s | 1, 2 | details |
#15 | WRONG ANSWER | 0.01 s | 1, 2 | details |
#16 | WRONG ANSWER | 0.03 s | 1, 2 | details |
#17 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#18 | WRONG ANSWER | 0.01 s | 1, 2 | details |
#19 | WRONG ANSWER | 0.03 s | 1, 2 | details |
#20 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#21 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#22 | WRONG ANSWER | 0.03 s | 1, 2 | details |
#23 | WRONG ANSWER | 0.03 s | 1, 2 | details |
#24 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#25 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#26 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#27 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#28 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#29 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#30 | WRONG ANSWER | 0.04 s | 1, 2 | details |
#31 | WRONG ANSWER | 0.14 s | 2 | details |
#32 | WRONG ANSWER | 0.21 s | 2 | details |
#33 | TIME LIMIT EXCEEDED | -- | 2 | details |
#34 | WRONG ANSWER | 0.45 s | 2 | details |
#35 | TIME LIMIT EXCEEDED | -- | 2 | details |
#36 | WRONG ANSWER | 0.38 s | 2 | details |
#37 | WRONG ANSWER | 0.15 s | 2 | details |
#38 | WRONG ANSWER | 0.20 s | 2 | details |
#39 | WRONG ANSWER | 0.15 s | 2 | details |
#40 | WRONG ANSWER | 0.20 s | 2 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:54:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int64_t i=0; i<temp.size(); i++){ ~^~~~~~~~~~~~
Code
#include <bits/stdc++.h> using namespace std; #define F first #define S second int64_t n,m; pair<int64_t,int64_t> info[100001]; int64_t v[100001]; pair<int64_t,int64_t> ans[100001]; set<pair<int64_t,int64_t>> l; int main(){ cin >> n >> m; for(int64_t i=0; i<n; i++){ int64_t b; cin >> b >> info[i+1].F >> info[i+1].S; v[i+1] = b; ans[i+1].F = 0; ans[i+1].S = 0; } int64_t boss[100001]; for(int64_t i=0; i<n; i++){ boss[i+1] = 0; } for(int64_t i=0; i<n; i++){ boss[v[i+1]]++; } for(int64_t i=0; i<n; i++){ if(!boss[i+1]){ l.insert({info[i+1].F,i+1}); } } while(1){ auto it = l.begin(); int64_t s=0; while((it != l.end()) && ((s+(*it).F) <= m)){ s += (*it).F; it++; } if(it == l.end()){ break; } vector<pair<int64_t,int64_t>> temp; auto it2 = it; while(it != l.end()){ boss[v[(*it).S]]--; if(boss[v[(*it).S]] == 0){ temp.push_back({info[v[(*it).S]].F,v[(*it).S]}); } it++; } l.erase(it2,l.end()); for(int64_t i=0; i<temp.size(); i++){ l.insert(temp[i]); } } for(auto it = l.begin(); it != l.end(); it++){ int64_t index = (*it).S; int64_t p = (*it).F; index = v[index]; while(index != 0){ ans[index].F += p; if((info[index].F < p) && (boss[index] == 1)){ p = info[index].F; } ans[index].S++; index = v[index]; } } for(int64_t i=0; i<n; i++){ if((ans[i+1].F+info[i+1].F) <= m){ ans[i+1].S++; } } int64_t vastaus = 0; for(int64_t i=0; i<n; i++){ vastaus = max(vastaus, ans[i+1].S*info[i+1].S); } cout << vastaus << "\n"; }
Test details
Test 1
Group: 1, 2
Verdict: ACCEPTED
input |
---|
10 1000000000 0 1 99007575 1 2 438573466 1 2 1000000000 1 1 353443732 ... |
correct output |
---|
1000000000 |
user output |
---|
1000000000 |
Test 2
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
10 945055475 0 5366694 291855561 1 90389570 179906938 1 374697552 698585353 1 6176408 179386869 ... |
correct output |
---|
2918555610 |
user output |
---|
2626700049 |
Test 3
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
10 1000000000 0 1 200065469 1 1 86267619 2 2 252169035 3 2 442282498 ... |
correct output |
---|
5000000000 |
user output |
---|
2000000000 |
Test 4
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
10 149461880 0 19086773 254109086 1 872978 319976205 2 659016 285454579 3 1044387 215101985 ... |
correct output |
---|
2879785845 |
user output |
---|
2000000000 |
Test 5
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
10 1000000000 0 1 280411779 1 1 492376696 1 2 265769381 3 2 522023560 ... |
correct output |
---|
2804117790 |
user output |
---|
1328681876 |
Test 6
Group: 1, 2
Verdict: ACCEPTED
input |
---|
10 992314729 0 247471573 72238893 1 496728 403783391 1 56679 169951367 1 62461804 383546017 ... |
correct output |
---|
1000000000 |
user output |
---|
1000000000 |
Test 7
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
10 1000000000 0 2 119191472 1 1 191898197 1 1 167040153 2 1 458449277 ... |
correct output |
---|
1191914720 |
user output |
---|
1135197594 |
Test 8
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
10 642370756 0 2000999 69581402 1 2242288 236497242 2 40562274 503433968 1 29295199 223094365 ... |
correct output |
---|
1182486210 |
user output |
---|
1006867936 |
Test 9
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
10 1000000000 0 2 162993968 1 1 283390160 1 2 225721923 2 1 370915202 ... |
correct output |
---|
1629939680 |
user output |
---|
1140957776 |
Test 10
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
10 370763744 0 744267 91981605 1 4017320 112823498 2 2034586 349731065 1 434048 227023578 ... |
correct output |
---|
4000000000 |
user output |
---|
2000000000 |
Test 11
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
100 1000000000 0 2 21970731 1 2 222398317 1 2 74179205 1 2 366800569 ... |
correct output |
---|
2197073100 |
user output |
---|
1977365790 |
Test 12
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
100 627156359 0 466164 39507144 1 2644648 194670076 1 438985 737387156 1 92923 226930065 ... |
correct output |
---|
3200078664 |
user output |
---|
3042050088 |
Test 13
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
100 1000000000 0 2 60428570 1 1 66827295 2 2 24238861 3 2 32334192 ... |
correct output |
---|
15719400724 |
user output |
---|
1789517366 |
Test 14
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
100 578318939 0 5917123 49385496 1 73642 30838210 2 345236 19772120 3 1361234 33138006 ... |
correct output |
---|
11974219660 |
user output |
---|
1473750112 |
Test 15
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
100 1000000000 0 1 23430721 1 2 41155410 2 1 154924553 2 2 199287253 ... |
correct output |
---|
4419752888 |
user output |
---|
2265448790 |
Test 16
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
100 630848484 0 247658 17408547 1 6205477 34571812 2 3328020 317217034 2 509839 75788562 ... |
correct output |
---|
6136951750 |
user output |
---|
3143316750 |
Test 17
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
100 1000000000 0 1 61153166 1 2 113719784 2 1 126178940 1 2 84704700 ... |
correct output |
---|
6115316600 |
user output |
---|
2615555032 |
Test 18
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
100 407636072 0 67732 54528930 1 2021009 86259093 2 532225 75204851 3 7672116 55824152 ... |
correct output |
---|
4362314400 |
user output |
---|
1908512550 |
Test 19
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
100 1000000000 0 1 78946076 1 1 178201433 1 2 305193695 3 2 244974740 ... |
correct output |
---|
7894607600 |
user output |
---|
3868357724 |
Test 20
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
100 872316903 0 233970 44229910 1 12892849 87606228 1 51239273 284778432 3 553859 500643173 ... |
correct output |
---|
3767067804 |
user output |
---|
2415746576 |
Test 21
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
3000 1000000000 0 1 4069630 1 1 73108926 1 2 172743214 1 2 147512131 ... |
correct output |
---|
12208890000 |
user output |
---|
11040906190 |
Test 22
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
3000 249317273 0 46667 14687857 1 5272676 245994938 1 36279 97314566 1 69173951 117305676 ... |
correct output |
---|
12910626303 |
user output |
---|
12675620591 |
Test 23
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
3000 1000000000 0 1 2842710 1 1 8191203 2 1 10476640 3 2 2514314 ... |
correct output |
---|
51266111120 |
user output |
---|
4866736816 |
Test 24
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
3000 545553877 0 1112 6623376 1 55084 2983142 2 26477 2238036 3 198454 3651580 ... |
correct output |
---|
63153045378 |
user output |
---|
4488642906 |
Test 25
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
3000 1000000000 0 1 2551098 1 2 4658134 1 1 9714530 3 1 111665704 ... |
correct output |
---|
31822628332 |
user output |
---|
16049957088 |
Test 26
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
3000 627288487 0 5565 4902237 1 193311 6120910 2 884633 236261695 2 181129 206714678 ... |
correct output |
---|
24651134280 |
user output |
---|
10311065844 |
Test 27
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
3000 1000000000 0 1 1630704 1 1 1987962 2 2 5589119 3 1 7223970 ... |
correct output |
---|
13888769780 |
user output |
---|
5639399810 |
Test 28
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
3000 122350483 0 5104 6655606 1 25846 5650899 2 891 27854633 3 45821 6472808 ... |
correct output |
---|
10919016136 |
user output |
---|
4289613482 |
Test 29
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
3000 1000000000 0 2 2232598 1 1 81685454 1 2 3595234 3 1 43985678 ... |
correct output |
---|
8707360817 |
user output |
---|
4321335086 |
Test 30
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
3000 93224783 0 77920 4177581 1 781837 203726716 1 1778939 11140736 3 420662 151618788 ... |
correct output |
---|
7551674202 |
user output |
---|
3873812914 |
Test 31
Group: 2
Verdict: WRONG ANSWER
input |
---|
100000 1000000000 0 2 321236 1 2 179850797 1 2 250783699 1 2 58417453 ... |
correct output |
---|
32123600000 |
user output |
---|
29079888900 |
Test 32
Group: 2
Verdict: WRONG ANSWER
input |
---|
100000 683735612 0 176 3239903 1 7051312 109522014 1 76136860 150341229 1 136391824 64274512 ... |
correct output |
---|
17223324348 |
user output |
---|
17190925318 |
Test 33
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 1000000000 0 1 649767 1 1 96445010 1 2 439168 3 1 302538 ... |
correct output |
---|
310649499192 |
user output |
---|
(empty) |
Test 34
Group: 2
Verdict: WRONG ANSWER
input |
---|
100000 317705311 0 206 255096 1 119 494287 2 112 858730 3 1706 695289 ... |
correct output |
---|
315602908920 |
user output |
---|
6076887570 |
Test 35
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 1000000000 0 1 336376 1 2 429262 2 2 345898 3 1 182789191 ... |
correct output |
---|
237426733440 |
user output |
---|
(empty) |
Test 36
Group: 2
Verdict: WRONG ANSWER
input |
---|
100000 523689236 0 919 731907 1 719 1388722 2 702067 109156645 2 565641 70468645 ... |
correct output |
---|
69814449632 |
user output |
---|
15617679560 |
Test 37
Group: 2
Verdict: WRONG ANSWER
input |
---|
100000 1000000000 0 2 741680 1 2 1508388 1 1 439923 3 1 2729202 ... |
correct output |
---|
75493311012 |
user output |
---|
29505577668 |
Test 38
Group: 2
Verdict: WRONG ANSWER
input |
---|
100000 436318930 0 1491 938295 1 129 2746241 1 4122 798475 2 328 1832583 ... |
correct output |
---|
15408385650 |
user output |
---|
7151211564 |
Test 39
Group: 2
Verdict: WRONG ANSWER
input |
---|
100000 1000000000 0 1 1360440 1 2 896990 1 1 15962331 1 2 96044616 ... |
correct output |
---|
136044000000 |
user output |
---|
67977105480 |
Test 40
Group: 2
Verdict: WRONG ANSWER
input |
---|
100000 180365096 0 2318 1013091 1 180676 9091850 1 218298 10068890 2 2397728 69882120 ... |
correct output |
---|
7442506125 |
user output |
---|
5283269565 |