# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
282040 | 2020-08-23T20:47:59 Z | mat_v | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 768 ms | 114408 KB |
#include "crocodile.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i)) #define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i)) #define mod 998244353 #define xx first #define yy second #define all(a) (a).begin(), (a).end() #define pb push_back #define ll long long #define pii pair<int,ll> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less) mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); int n,m; vector<pii> graf[1000005]; pii dist[1000005]; priority_queue<pii> pq; void djikstra(){ while(!pq.empty()){ pii sta = pq.top(); ll duz = -sta.xx; int koji = sta.yy; if(duz != dist[koji].yy){ pq.pop(); continue; } //cout << koji << " " << duz << "\n"; //cout << dist[koji].xx << " " << dist[koji].yy << "\n"; pq.pop(); for(auto c:graf[koji]){ ll tmpduz = duz + c.yy; pii tr = dist[c.xx]; pii novi = tr; if(tmpduz < novi.xx)novi = {tmpduz, novi.xx}; else if(tmpduz < novi.yy)novi = {novi.xx, tmpduz}; if(novi.yy < tr.yy){ dist[c.xx] = novi; pq.push({-novi.yy, c.xx}); } dist[c.xx] = novi; } } } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { n = N; m = M; ff(j,0,m - 1){ int a = R[j][0]; int b = R[j][1]; a++; b++; ll c = L[j]; graf[a].pb({b,c}); graf[b].pb({a,c}); } ll maks = 1e8; maks *= maks; ff(i,1,n)dist[i] = {maks, maks}; ff(i,0,K - 1){ int x = P[i]; x++; pq.push({0,x}); dist[x] = {0,0}; } djikstra(); return dist[1].yy; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 23808 KB | Output is correct |
2 | Correct | 14 ms | 23808 KB | Output is correct |
3 | Correct | 15 ms | 23808 KB | Output is correct |
4 | Correct | 15 ms | 23936 KB | Output is correct |
5 | Correct | 15 ms | 23936 KB | Output is correct |
6 | Correct | 15 ms | 23936 KB | Output is correct |
7 | Correct | 15 ms | 23936 KB | Output is correct |
8 | Correct | 17 ms | 23936 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 23808 KB | Output is correct |
2 | Correct | 14 ms | 23808 KB | Output is correct |
3 | Correct | 15 ms | 23808 KB | Output is correct |
4 | Correct | 15 ms | 23936 KB | Output is correct |
5 | Correct | 15 ms | 23936 KB | Output is correct |
6 | Correct | 15 ms | 23936 KB | Output is correct |
7 | Correct | 15 ms | 23936 KB | Output is correct |
8 | Correct | 17 ms | 23936 KB | Output is correct |
9 | Correct | 16 ms | 24224 KB | Output is correct |
10 | Correct | 17 ms | 23808 KB | Output is correct |
11 | Correct | 16 ms | 24064 KB | Output is correct |
12 | Correct | 18 ms | 24448 KB | Output is correct |
13 | Correct | 18 ms | 24576 KB | Output is correct |
14 | Correct | 15 ms | 23936 KB | Output is correct |
15 | Correct | 15 ms | 23936 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 23808 KB | Output is correct |
2 | Correct | 14 ms | 23808 KB | Output is correct |
3 | Correct | 15 ms | 23808 KB | Output is correct |
4 | Correct | 15 ms | 23936 KB | Output is correct |
5 | Correct | 15 ms | 23936 KB | Output is correct |
6 | Correct | 15 ms | 23936 KB | Output is correct |
7 | Correct | 15 ms | 23936 KB | Output is correct |
8 | Correct | 17 ms | 23936 KB | Output is correct |
9 | Correct | 16 ms | 24224 KB | Output is correct |
10 | Correct | 17 ms | 23808 KB | Output is correct |
11 | Correct | 16 ms | 24064 KB | Output is correct |
12 | Correct | 18 ms | 24448 KB | Output is correct |
13 | Correct | 18 ms | 24576 KB | Output is correct |
14 | Correct | 15 ms | 23936 KB | Output is correct |
15 | Correct | 15 ms | 23936 KB | Output is correct |
16 | Correct | 681 ms | 89652 KB | Output is correct |
17 | Correct | 128 ms | 37740 KB | Output is correct |
18 | Correct | 163 ms | 43504 KB | Output is correct |
19 | Correct | 768 ms | 114408 KB | Output is correct |
20 | Correct | 410 ms | 88696 KB | Output is correct |
21 | Correct | 67 ms | 31736 KB | Output is correct |
22 | Correct | 418 ms | 85876 KB | Output is correct |