Task: | Shallow waters |
Sender: | aalto2024h_007 |
Submission time: | 2024-10-23 17:48:58 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | ACCEPTED | 0.00 s | details |
#8 | ACCEPTED | 0.00 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | ACCEPTED | 0.00 s | details |
#12 | ACCEPTED | 0.00 s | details |
#13 | ACCEPTED | 0.00 s | details |
#14 | ACCEPTED | 0.00 s | details |
#15 | ACCEPTED | 0.00 s | details |
#16 | ACCEPTED | 0.00 s | details |
#17 | ACCEPTED | 0.00 s | details |
#18 | ACCEPTED | 0.00 s | details |
#19 | ACCEPTED | 0.00 s | details |
#20 | ACCEPTED | 0.00 s | details |
#21 | ACCEPTED | 0.00 s | details |
#22 | ACCEPTED | 0.00 s | details |
#23 | ACCEPTED | 0.00 s | details |
#24 | ACCEPTED | 0.00 s | details |
#25 | ACCEPTED | 0.00 s | details |
#26 | ACCEPTED | 0.00 s | details |
#27 | ACCEPTED | 0.00 s | details |
#28 | ACCEPTED | 0.00 s | details |
#29 | ACCEPTED | 0.00 s | details |
#30 | ACCEPTED | 0.00 s | details |
#31 | ACCEPTED | 0.00 s | details |
#32 | ACCEPTED | 0.02 s | details |
#33 | ACCEPTED | 0.02 s | details |
#34 | ACCEPTED | 0.02 s | details |
#35 | ACCEPTED | 0.02 s | details |
#36 | ACCEPTED | 0.02 s | details |
#37 | ACCEPTED | 0.02 s | details |
#38 | ACCEPTED | 0.02 s | details |
#39 | ACCEPTED | 0.02 s | details |
#40 | ACCEPTED | 0.02 s | details |
#41 | ACCEPTED | 0.02 s | details |
#42 | ACCEPTED | 0.12 s | details |
#43 | ACCEPTED | 0.12 s | details |
#44 | ACCEPTED | 0.12 s | details |
#45 | ACCEPTED | 0.12 s | details |
#46 | ACCEPTED | 0.12 s | details |
#47 | ACCEPTED | 0.12 s | details |
#48 | ACCEPTED | 0.12 s | details |
#49 | ACCEPTED | 0.12 s | details |
#50 | ACCEPTED | 0.12 s | details |
#51 | ACCEPTED | 0.12 s | details |
#52 | TIME LIMIT EXCEEDED | -- | details |
#53 | TIME LIMIT EXCEEDED | -- | details |
#54 | TIME LIMIT EXCEEDED | -- | details |
#55 | TIME LIMIT EXCEEDED | -- | details |
#56 | TIME LIMIT EXCEEDED | -- | details |
#57 | TIME LIMIT EXCEEDED | -- | details |
#58 | TIME LIMIT EXCEEDED | -- | details |
#59 | TIME LIMIT EXCEEDED | -- | details |
#60 | TIME LIMIT EXCEEDED | -- | details |
#61 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <bits/stdc++.h> using namespace std; //Definitions for quicker writing #define REP(i,a,b) for (int i = a; i < b; i++) #define PB push_back #define MP make_pair #define F first #define S second //Typedefs for quicker writing typedef long long ll; typedef vector<int> vi; typedef vector<long long> vl; typedef pair<int,int> pi; typedef pair<long long, long long> pl; //Max values const long long lmx = LLONG_MAX; const int imx = INT_MAX; int main() { //IO optimization ios::sync_with_stdio(0); cin.tie(0); //Input definition int n; int q; //Read In cin >> n >> q; //Init adj list vector<vector<pair<ll, ll>>> adj(n); vector<vl> depth(n); REP(i,0,n){ REP(j,0,n){ ll d; cin >> d; adj[i].push_back({j,d}); depth[i].push_back(0); } } pi quer[q]; REP(i,0,q){ cin >> quer[i].F; cin >> quer[i].S; } //Init processed //vector<bool> proc(n+1,false); int start,end; REP(i,0,n){ start = i; //Init priority queue priority_queue<pair<ll,ll>> q; q.push({lmx,start}); depth[start][start] = lmx; //Dijkstra while(!q.empty()){ ll cur = q.top().S; q.pop(); for(auto neigh : adj[cur]){ ll next = neigh.F; ll d = neigh.S; d = min(d, depth[start][cur]); if(d > depth[start][next]){ depth[start][next] = d; q.push({depth[start][next], next}); } } } } //Write out REP(i,0,q){ start = (quer[i].F-1); end = (quer[i].S-1); cout << depth[start][end] << "\n"; } //Return return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
2 1 0 39 39 0 1 2 |
correct output |
---|
39 |
user output |
---|
39 |
Test 2
Verdict: ACCEPTED
input |
---|
2 1 0 48 48 0 2 1 |
correct output |
---|
48 |
user output |
---|
48 |
Test 3
Verdict: ACCEPTED
input |
---|
3 2 0 69 81 69 0 60 81 60 0 1 3 ... |
correct output |
---|
81 69 |
user output |
---|
81 69 |
Test 4
Verdict: ACCEPTED
input |
---|
3 1 0 41 45 41 0 64 45 64 0 1 2 |
correct output |
---|
45 |
user output |
---|
45 |
Test 5
Verdict: ACCEPTED
input |
---|
3 1 0 87 49 87 0 77 49 77 0 3 1 |
correct output |
---|
77 |
user output |
---|
77 |
Test 6
Verdict: ACCEPTED
input |
---|
3 3 0 56 38 56 0 7 38 7 0 1 2 ... |
correct output |
---|
56 38 38 |
user output |
---|
56 38 38 |
Test 7
Verdict: ACCEPTED
input |
---|
4 2 0 88 79 73 88 0 56 85 79 56 0 30 73 85 30 0 ... |
correct output |
---|
85 79 |
user output |
---|
85 79 |
Test 8
Verdict: ACCEPTED
input |
---|
4 1 0 54 20 63 54 0 100 37 20 100 0 33 63 37 33 0 ... |
correct output |
---|
54 |
user output |
---|
54 |
Test 9
Verdict: ACCEPTED
input |
---|
4 6 0 77 96 6 77 0 92 52 96 92 0 37 6 52 37 0 ... |
correct output |
---|
92 52 52 52 52 ... |
user output |
---|
92 52 52 52 52 ... |
Test 10
Verdict: ACCEPTED
input |
---|
4 2 0 41 12 88 41 0 57 61 12 57 0 77 88 61 77 0 ... |
correct output |
---|
61 88 |
user output |
---|
61 88 |
Test 11
Verdict: ACCEPTED
input |
---|
4 5 0 58 68 17 58 0 11 87 68 11 0 57 17 87 57 0 ... |
correct output |
---|
58 58 58 58 58 |
user output |
---|
58 58 58 58 58 |
Test 12
Verdict: ACCEPTED
input |
---|
5 4 0 86 65 6 80 86 0 39 97 82 65 39 0 28 53 6 97 28 0 48 ... |
correct output |
---|
86 86 86 65 |
user output |
---|
86 86 86 65 |
Test 13
Verdict: ACCEPTED
input |
---|
5 5 0 13 10 67 42 13 0 40 40 32 10 40 0 94 69 67 40 94 0 53 ... |
correct output |
---|
67 67 67 69 40 |
user output |
---|
67 67 67 69 40 |
Test 14
Verdict: ACCEPTED
input |
---|
5 5 0 95 34 12 63 95 0 16 30 82 34 16 0 49 53 12 30 49 0 69 ... |
correct output |
---|
69 82 69 82 53 |
user output |
---|
69 82 69 82 53 |
Test 15
Verdict: ACCEPTED
input |
---|
5 3 0 13 90 25 3 13 0 2 6 15 90 2 0 10 46 25 6 10 0 46 ... |
correct output |
---|
46 46 46 |
user output |
---|
46 46 46 |
Test 16
Verdict: ACCEPTED
input |
---|
5 4 0 86 22 70 78 86 0 15 26 1 22 15 0 91 20 70 26 91 0 58 ... |
correct output |
---|
86 70 70 70 |
user output |
---|
86 70 70 70 |
Test 17
Verdict: ACCEPTED
input |
---|
5 3 0 37 62 49 9 37 0 40 30 65 62 40 0 100 74 49 30 100 0 82 ... |
correct output |
---|
62 62 62 |
user output |
---|
62 62 62 |
Test 18
Verdict: ACCEPTED
input |
---|
5 3 0 7 60 54 44 7 0 10 34 76 60 10 0 49 74 54 34 49 0 39 ... |
correct output |
---|
60 54 74 |
user output |
---|
60 54 74 |
Test 19
Verdict: ACCEPTED
input |
---|
5 4 0 98 54 42 68 98 0 27 27 87 54 27 0 2 81 42 27 2 0 34 ... |
correct output |
---|
42 42 81 42 |
user output |
---|
42 42 81 42 |
Test 20
Verdict: ACCEPTED
input |
---|
5 5 0 38 2 41 56 38 0 62 53 15 2 62 0 88 55 41 53 88 0 71 ... |
correct output |
---|
56 62 62 56 71 |
user output |
---|
56 62 62 56 71 |
Test 21
Verdict: ACCEPTED
input |
---|
5 8 0 1 22 14 17 1 0 88 9 32 22 88 0 40 88 14 9 40 0 38 ... |
correct output |
---|
22 40 22 40 40 ... |
user output |
---|
22 40 22 40 40 ... |
Test 22
Verdict: ACCEPTED
input |
---|
10 26 0 65 80 9 98 64 27 62 36 68 65 0 82 65 48 59 19 15 62 18 80 82 0 3 80 15 78 62 44 22 9 65 3 0 81 54 74 23 91 36 ... |
correct output |
---|
98 81 76 80 80 ... |
user output |
---|
98 81 76 80 80 ... |
Test 23
Verdict: ACCEPTED
input |
---|
10 1 0 10 42 68 81 90 10 32 99 45 10 0 32 92 72 83 60 15 67 47 42 32 0 42 97 9 43 69 75 91 68 92 42 0 81 83 68 79 30 10 ... |
correct output |
---|
90 |
user output |
---|
90 |
Test 24
Verdict: ACCEPTED
input |
---|
10 25 0 34 63 79 51 60 47 39 97 43 34 0 82 26 30 57 37 62 51 81 63 82 0 86 7 23 21 80 51 44 79 26 86 0 29 23 47 100 22 36 ... |
correct output |
---|
81 81 81 66 100 ... |
user output |
---|
81 81 81 66 100 ... |
Test 25
Verdict: ACCEPTED
input |
---|
10 10 0 90 3 60 29 79 98 10 41 87 90 0 15 92 31 82 15 42 57 67 3 15 0 3 70 31 68 66 47 59 60 92 3 0 59 26 33 79 75 88 ... |
correct output |
---|
82 79 90 91 79 ... |
user output |
---|
82 79 90 91 79 ... |
Test 26
Verdict: ACCEPTED
input |
---|
10 41 0 22 78 60 44 8 53 55 40 51 22 0 1 82 2 7 88 22 64 47 78 1 0 1 95 61 94 53 63 69 60 82 1 0 4 18 84 19 23 36 ... |
correct output |
---|
78 78 61 78 64 ... |
user output |
---|
78 78 61 78 64 ... Truncated |
Test 27
Verdict: ACCEPTED
input |
---|
10 35 0 62 9 28 60 15 3 58 26 47 62 0 65 21 74 90 48 37 73 58 9 65 0 42 27 17 21 1 81 99 28 21 42 0 2 96 69 70 67 7 ... |
correct output |
---|
62 62 62 62 90 ... |
user output |
---|
62 62 62 62 90 ... Truncated |
Test 28
Verdict: ACCEPTED
input |
---|
10 35 0 60 44 100 6 55 72 72 75 38 60 0 76 92 68 58 47 80 39 74 44 76 0 82 72 13 100 94 73 71 100 92 82 0 15 9 55 89 47 25 ... |
correct output |
---|
89 83 89 89 92 ... |
user output |
---|
89 83 89 89 92 ... Truncated |
Test 29
Verdict: ACCEPTED
input |
---|
10 20 0 54 68 91 61 14 21 84 46 72 54 0 87 70 26 45 49 45 55 42 68 87 0 22 96 53 50 77 36 42 91 70 22 0 86 39 62 96 32 99 ... |
correct output |
---|
91 87 87 96 91 ... |
user output |
---|
91 87 87 96 91 ... |
Test 30
Verdict: ACCEPTED
input |
---|
10 9 0 2 56 43 7 23 3 32 7 80 2 0 15 36 30 54 34 15 65 23 56 15 0 29 99 40 36 44 61 99 43 36 29 0 68 95 28 12 14 57 ... |
correct output |
---|
90 67 67 90 67 ... |
user output |
---|
90 67 67 90 67 ... |
Test 31
Verdict: ACCEPTED
input |
---|
10 30 0 22 17 58 39 81 65 88 62 19 22 0 32 14 63 84 21 80 44 93 17 32 0 90 70 99 87 91 50 69 58 14 90 0 57 11 93 5 60 40 ... |
correct output |
---|
88 88 88 88 93 ... |
user output |
---|
88 88 88 88 93 ... |
Test 32
Verdict: ACCEPTED
input |
---|
100 4060 0 224279712 686036287 45105249... |
correct output |
---|
984509996 986462105 982248996 984656610 985935261 ... |
user output |
---|
984509996 986462105 982248996 984656610 985935261 ... Truncated |
Test 33
Verdict: ACCEPTED
input |
---|
100 676 0 527822662 997975632 53018119... |
correct output |
---|
993798769 991489320 988392606 975549477 986420088 ... |
user output |
---|
993798769 991489320 988392606 975549477 986420088 ... Truncated |
Test 34
Verdict: ACCEPTED
input |
---|
100 333 0 436234512 371770128 46427426... |
correct output |
---|
973778856 973778856 975526572 973096824 972749112 ... |
user output |
---|
973778856 973778856 975526572 973096824 972749112 ... Truncated |
Test 35
Verdict: ACCEPTED
input |
---|
100 3357 0 68472304 913723608 220052402... |
correct output |
---|
987176834 981901632 989344571 983084587 989344571 ... |
user output |
---|
987176834 981901632 989344571 983084587 989344571 ... Truncated |
Test 36
Verdict: ACCEPTED
input |
---|
100 3628 0 534502368 539714259 28374756... |
correct output |
---|
986332762 993409969 993409969 984535136 986332762 ... |
user output |
---|
986332762 993409969 993409969 984535136 986332762 ... Truncated |
Test 37
Verdict: ACCEPTED
input |
---|
100 4615 0 509293538 258847661 53332274... |
correct output |
---|
986084005 993410015 993410015 965516330 986242161 ... |
user output |
---|
986084005 993410015 993410015 965516330 986242161 ... Truncated |
Test 38
Verdict: ACCEPTED
input |
---|
100 2345 0 863913461 192636102 88476477... |
correct output |
---|
985034014 984712168 970064352 985034014 983716327 ... |
user output |
---|
985034014 984712168 970064352 985034014 983716327 ... Truncated |
Test 39
Verdict: ACCEPTED
input |
---|
100 4167 0 278244915 816596895 99494306... |
correct output |
---|
994650753 988169835 988586303 974999473 988169835 ... |
user output |
---|
994650753 988169835 988586303 974999473 988169835 ... Truncated |
Test 40
Verdict: ACCEPTED
input |
---|
100 2952 0 908068381 834928493 76958654... |
correct output |
---|
971019561 990687292 981311675 986274515 994580228 ... |
user output |
---|
971019561 990687292 981311675 986274515 994580228 ... Truncated |
Test 41
Verdict: ACCEPTED
input |
---|
100 1620 0 257277309 280264417 59391568... |
correct output |
---|
977276808 986699027 973703850 984814274 986229209 ... |
user output |
---|
977276808 986699027 973703850 984814274 986229209 ... Truncated |
Test 42
Verdict: ACCEPTED
input |
---|
200 455 0 686036287 971118925 48977720... |
correct output |
---|
991763634 993383365 989047420 993694416 992916290 ... |
user output |
---|
991763634 993383365 989047420 993694416 992916290 ... Truncated |
Test 43
Verdict: ACCEPTED
input |
---|
200 12733 0 997975632 145040139 59548994... |
correct output |
---|
992841688 994103522 994103522 993324323 993413618 ... |
user output |
---|
992841688 994103522 994103522 993324323 993413618 ... Truncated |
Test 44
Verdict: ACCEPTED
input |
---|
200 10671 0 371770128 104741444 35097588... |
correct output |
---|
994112705 992684847 991175588 992684847 991850584 ... |
user output |
---|
994112705 992684847 991175588 992684847 991850584 ... Truncated |
Test 45
Verdict: ACCEPTED
input |
---|
200 785 0 913723608 846741138 23261249... |
correct output |
---|
991015102 991393613 991393613 991393613 991393613 ... |
user output |
---|
991015102 991393613 991393613 991393613 991393613 ... Truncated |
Test 46
Verdict: ACCEPTED
input |
---|
200 4341 0 539714259 993409969 52728320... |
correct output |
---|
995748996 992259426 995648041 995748996 995748996 ... |
user output |
---|
995748996 992259426 995648041 995748996 995748996 ... Truncated |
Test 47
Verdict: ACCEPTED
input |
---|
200 10033 0 258847661 29756805 772449744... |
correct output |
---|
994518775 994534294 994518775 974715985 990234431 ... |
user output |
---|
994518775 994534294 994518775 974715985 990234431 ... Truncated |
Test 48
Verdict: ACCEPTED
input |
---|
200 19576 0 192636102 43478262 277317100... |
correct output |
---|
990666123 991249036 990616659 991249036 991249036 ... |
user output |
---|
990666123 991249036 990616659 991249036 991249036 ... Truncated |
Test 49
Verdict: ACCEPTED
input |
---|
200 17516 0 816596895 223011120 40179408... |
correct output |
---|
989788855 989788855 989788855 989788855 989788855 ... |
user output |
---|
989788855 989788855 989788855 989788855 989788855 ... Truncated |
Test 50
Verdict: ACCEPTED
input |
---|
200 2236 0 834928493 789779330 75492200... |
correct output |
---|
990202245 990881031 993287512 993287512 996688854 ... |
user output |
---|
990202245 990881031 993287512 993287512 996688854 ... Truncated |
Test 51
Verdict: ACCEPTED
input |
---|
200 13669 0 280264417 35137122 58869367 ... |
correct output |
---|
985495492 987275634 987275634 987275634 987275634 ... |
user output |
---|
985495492 987275634 987275634 987275634 987275634 ... Truncated |
Test 52
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 44127 0 623250361 488402074 93887976... |
correct output |
---|
997518315 997518315 997518315 997518315 997247172 ... |
user output |
---|
(empty) |
Test 53
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 89310 0 410279705 670881494 19798128... |
correct output |
---|
994290020 994290020 994290020 994290020 994290020 ... |
user output |
---|
(empty) |
Test 54
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 32068 0 556762013 260875339 89984504... |
correct output |
---|
996936245 996567301 996936245 996936245 996393864 ... |
user output |
---|
(empty) |
Test 55
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 81911 0 365429213 243439455 38401914... |
correct output |
---|
996657976 995517614 996657976 996419449 996657976 ... |
user output |
---|
(empty) |
Test 56
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 66557 0 736625865 907021066 67376384... |
correct output |
---|
996250418 996250418 996250418 996250418 996250418 ... |
user output |
---|
(empty) |
Test 57
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 28215 0 507642456 772882187 23298617... |
correct output |
---|
996927836 995199945 988550843 996861124 996927836 ... |
user output |
---|
(empty) |
Test 58
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 4722 0 681246594 433718444 81827072... |
correct output |
---|
996596738 995772851 996596738 995904634 994249067 ... |
user output |
---|
(empty) |
Test 59
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 66897 0 670154826 911171975 19319438... |
correct output |
---|
997410816 997103192 997322209 997322209 997410816 ... |
user output |
---|
(empty) |
Test 60
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 4171 0 998224343 144467837 75333130... |
correct output |
---|
997492638 996317859 993722528 996341116 997492638 ... |
user output |
---|
(empty) |
Test 61
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 18979 0 722938317 668705452 11233444... |
correct output |
---|
997573682 994464545 996219897 997093906 997573682 ... |
user output |
---|
(empty) |