답안 #729982

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
729982 2023-04-25T02:16:58 Z hoainiem 악어의 지하 도시 (IOI11_crocodile) C++14
89 / 100
2000 ms 64612 KB
#include "crocodile.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define nmax 100008
const long long inf = 1e18;
using namespace std;
typedef pair<long long, long long> pii;
pii operator+(pii x, long long y){
    return (y <= x.fi) ? make_pair(y, x.fi) : ((y < x.se) ? make_pair(x.fi, y) : x);
}
int n, m;
bool kt[nmax];
pii f[nmax];
vector<pii> l[nmax];
priority_queue<pii, vector<pii>, greater<pii> > s;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
    n = N;
    m = M;
    fill(f, f + n + 1, make_pair(inf, inf));
    fill(kt, kt + n + 1, false);
    for (int i = 0; i < m; i++){
        int u = R[i][0], v = R[i][1], w = L[i];
        l[u].push_back({v, w});
        l[v].push_back({u, w});
    }
    for (int i = 0; i < K; i++)
        f[P[i]] = {0, 0};
    while (!kt[0]){
        int sp = -1;
        for (int i = 0; i <= n; i++)
            if (kt[i] || f[i].se == inf)
                continue;
            else{
                if (sp == -1 || f[i].se < f[sp].se)
                    sp = i;
            }
        if (sp == -1)
            break;
        kt[sp] = true;
        for (pii it : l[sp]){
            if (kt[it.fi])
                continue;
            f[it.fi] = f[it.fi] + (f[sp].se + it.se);
        }
    }
    return f[0].se;
}


# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 4 ms 2644 KB Output is correct
5 Correct 4 ms 2644 KB Output is correct
6 Correct 3 ms 2644 KB Output is correct
7 Correct 4 ms 2644 KB Output is correct
8 Correct 6 ms 2772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 4 ms 2644 KB Output is correct
5 Correct 4 ms 2644 KB Output is correct
6 Correct 3 ms 2644 KB Output is correct
7 Correct 4 ms 2644 KB Output is correct
8 Correct 6 ms 2772 KB Output is correct
9 Correct 3 ms 3028 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 2 ms 2772 KB Output is correct
12 Correct 4 ms 3284 KB Output is correct
13 Correct 5 ms 3284 KB Output is correct
14 Correct 3 ms 2644 KB Output is correct
15 Correct 2 ms 2772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 4 ms 2644 KB Output is correct
5 Correct 4 ms 2644 KB Output is correct
6 Correct 3 ms 2644 KB Output is correct
7 Correct 4 ms 2644 KB Output is correct
8 Correct 6 ms 2772 KB Output is correct
9 Correct 3 ms 3028 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 2 ms 2772 KB Output is correct
12 Correct 4 ms 3284 KB Output is correct
13 Correct 5 ms 3284 KB Output is correct
14 Correct 3 ms 2644 KB Output is correct
15 Correct 2 ms 2772 KB Output is correct
16 Execution timed out 2073 ms 64612 KB Time limit exceeded
17 Halted 0 ms 0 KB -