# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
725679 | 2023-04-17T21:08:36 Z | Bogdan1110 | Crocodile's Underground City (IOI11_crocodile) | C++14 | 459 ms | 48788 KB |
#include <bits/stdc++.h> #define FAST {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);} #define FILES {freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);} #define ll long long #define ull unsigned long long #define pqueue priority_queue #define pb push_back #define fi first #define se second #define ld long double #define pii pair<int,int> #define pll pair<long long,long long> #define all(a) (a).begin(), (a).end() #define mp make_pair using namespace std; // order_of_key -> # less than k // find_by_order -> k-th element // pq max element void files() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } const double eps = 0.00000001; const int NMAX = 100010; const ll inf = LLONG_MAX/3; const ll modi = 998244353; vector<pii>al[NMAX]; int d[NMAX][2]; int visited[NMAX]; int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) { for (int i = 0 ; i < m ; i++ ) { al[r[i][0]].pb({r[i][1], l[i]}); al[r[i][1]].pb({r[i][0], l[i]}); } priority_queue<pii>q; for (int i = 0 ; i < k ; i++ ) { q.push({0,p[i]}); } for (int i = 0 ; i < NMAX ; i++ ) { d[i][0] = d[i][1] = INT_MAX; } while(!q.empty()) { int nd = q.top().se; int dist = -q.top().fi; q.pop(); if ( visited[nd] ) continue; visited[nd] = true; if ( nd == 0 ) return dist; for (auto u : al[nd]) { int sl = u.fi; int kol = u.se; if ( dist + kol < d[sl][1] ) { d[sl][1] = dist + kol; if ( d[sl][1] < d[sl][0] ) swap(d[sl][0], d[sl][1]); if ( d[sl][1] < INT_MAX ) q.push({-d[sl][1], sl}); } } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 3432 KB | Output is correct |
2 | Correct | 2 ms | 3428 KB | Output is correct |
3 | Correct | 3 ms | 3412 KB | Output is correct |
4 | Correct | 3 ms | 3444 KB | Output is correct |
5 | Correct | 3 ms | 3440 KB | Output is correct |
6 | Correct | 2 ms | 3412 KB | Output is correct |
7 | Correct | 3 ms | 3412 KB | Output is correct |
8 | Correct | 3 ms | 3412 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 3432 KB | Output is correct |
2 | Correct | 2 ms | 3428 KB | Output is correct |
3 | Correct | 3 ms | 3412 KB | Output is correct |
4 | Correct | 3 ms | 3444 KB | Output is correct |
5 | Correct | 3 ms | 3440 KB | Output is correct |
6 | Correct | 2 ms | 3412 KB | Output is correct |
7 | Correct | 3 ms | 3412 KB | Output is correct |
8 | Correct | 3 ms | 3412 KB | Output is correct |
9 | Correct | 4 ms | 3700 KB | Output is correct |
10 | Correct | 3 ms | 3412 KB | Output is correct |
11 | Correct | 3 ms | 3540 KB | Output is correct |
12 | Correct | 5 ms | 3924 KB | Output is correct |
13 | Correct | 5 ms | 3924 KB | Output is correct |
14 | Correct | 2 ms | 3412 KB | Output is correct |
15 | Correct | 3 ms | 3540 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 3432 KB | Output is correct |
2 | Correct | 2 ms | 3428 KB | Output is correct |
3 | Correct | 3 ms | 3412 KB | Output is correct |
4 | Correct | 3 ms | 3444 KB | Output is correct |
5 | Correct | 3 ms | 3440 KB | Output is correct |
6 | Correct | 2 ms | 3412 KB | Output is correct |
7 | Correct | 3 ms | 3412 KB | Output is correct |
8 | Correct | 3 ms | 3412 KB | Output is correct |
9 | Correct | 4 ms | 3700 KB | Output is correct |
10 | Correct | 3 ms | 3412 KB | Output is correct |
11 | Correct | 3 ms | 3540 KB | Output is correct |
12 | Correct | 5 ms | 3924 KB | Output is correct |
13 | Correct | 5 ms | 3924 KB | Output is correct |
14 | Correct | 2 ms | 3412 KB | Output is correct |
15 | Correct | 3 ms | 3540 KB | Output is correct |
16 | Correct | 400 ms | 45308 KB | Output is correct |
17 | Correct | 64 ms | 14028 KB | Output is correct |
18 | Correct | 83 ms | 15512 KB | Output is correct |
19 | Correct | 459 ms | 48788 KB | Output is correct |
20 | Correct | 276 ms | 40952 KB | Output is correct |
21 | Correct | 35 ms | 8280 KB | Output is correct |
22 | Correct | 289 ms | 35964 KB | Output is correct |