답안 #595107

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
595107 2022-07-13T11:17:28 Z Bench0310 악어의 지하 도시 (IOI11_crocodile) C++17
100 / 100
518 ms 71276 KB
#include <bits/stdc++.h>
#include "crocodile.h"

using namespace std;
typedef long long ll;

int travel_plan(int n,int m,int r[][2],int l[],int k,int p[])
{
    vector<array<int,2>> v[n];
    for(int i=0;i<m;i++)
    {
        int a=r[i][0],b=r[i][1];
        int c=l[i];
        v[a].push_back({b,c});
        v[b].push_back({a,c});
    }
    priority_queue<array<int,2>,vector<array<int,2>>,greater<>> q;
    vector<int> vis(n,0);
    for(int i=0;i<k;i++) for(int j=0;j<2;j++) q.push({0,p[i]});
    const int lim=1000000000;
    while(!q.empty())
    {
        auto [d,a]=q.top();
        q.pop();
        if((++vis[a])!=2) continue;
        if(a==0) return d;
        for(auto [to,c]:v[a]) if(d+c<=lim) q.push({d+c,to});
    }
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
   29 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 7 ms 1108 KB Output is correct
13 Correct 3 ms 836 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 7 ms 1108 KB Output is correct
13 Correct 3 ms 836 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 453 ms 71276 KB Output is correct
17 Correct 91 ms 13276 KB Output is correct
18 Correct 85 ms 14808 KB Output is correct
19 Correct 480 ms 67064 KB Output is correct
20 Correct 270 ms 47308 KB Output is correct
21 Correct 41 ms 5916 KB Output is correct
22 Correct 518 ms 44828 KB Output is correct