답안 #1072267

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1072267 2024-08-23T16:08:07 Z dwuy 악어의 지하 도시 (IOI11_crocodile) C++14
100 / 100
293 ms 65212 KB
/**         - dwuy -
 
      />    フ
      |  _  _|
      /`ミ _x ノ
     /      |
    /   ヽ   ?
 / ̄|   | | |
 | ( ̄ヽ__ヽ_)_)
 \二つ
 
**/
#include <bits/stdc++.h>
#include "crocodile.h"
 
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout)
#define fi first
#define se second
#define endl "\n"
#define len(s) (int)((s).size())
#define MASK(k)(1LL<<(k))
#define TASK "test"
 
using namespace std;
 
typedef tuple<int, int, int> tpiii;
typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef long long ll;
 
const long long OO = 1e18;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MX = 100005;
 
int n, m;
int cnt[MX];
vector<pii> G[MX];
 
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
    n = N;
    m = M;
    for(int i=0; i<m; i++){
        int u = R[i][0] + 1;
        int v = R[i][1] + 1;
        int c = L[i];
        G[u].push_back({v, c});
        G[v].push_back({u, c});
    }
    
    priority_queue<pii, vector<pii>, greater<pii>> Q;
    for(int i=0; i<K; i++){
        int u = P[i] + 1;
        Q.push({0, u});
        cnt[u] = 1;
    }
    while(Q.size()){
        int du, u;
        tie(du, u) = Q.top();
        Q.pop();
        cnt[u]++;
        if(cnt[u] != 2) continue;
        if(u == 1) return du;
        for(pii edge: G[u]){
            int v, c;
            tie(v, c) = edge;
            if(cnt[v] < 2) Q.push({du + c, v});
        }
    }
    return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 2 ms 2652 KB Output is correct
5 Correct 2 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 2 ms 2652 KB Output is correct
5 Correct 2 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2908 KB Output is correct
9 Correct 3 ms 2908 KB Output is correct
10 Correct 2 ms 2652 KB Output is correct
11 Correct 2 ms 2908 KB Output is correct
12 Correct 5 ms 3420 KB Output is correct
13 Correct 4 ms 3164 KB Output is correct
14 Correct 1 ms 2652 KB Output is correct
15 Correct 2 ms 2908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 2 ms 2652 KB Output is correct
5 Correct 2 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2908 KB Output is correct
9 Correct 3 ms 2908 KB Output is correct
10 Correct 2 ms 2652 KB Output is correct
11 Correct 2 ms 2908 KB Output is correct
12 Correct 5 ms 3420 KB Output is correct
13 Correct 4 ms 3164 KB Output is correct
14 Correct 1 ms 2652 KB Output is correct
15 Correct 2 ms 2908 KB Output is correct
16 Correct 293 ms 62656 KB Output is correct
17 Correct 48 ms 13396 KB Output is correct
18 Correct 60 ms 14932 KB Output is correct
19 Correct 293 ms 65212 KB Output is correct
20 Correct 185 ms 48452 KB Output is correct
21 Correct 28 ms 7712 KB Output is correct
22 Correct 277 ms 44988 KB Output is correct