답안 #198555

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
198555 2020-01-26T14:48:14 Z alexandra_udristoiu 악어의 지하 도시 (IOI11_crocodile) C++14
89 / 100
2000 ms 56256 KB
#include "crocodile.h"
#include<iostream>
#include<vector>
#define DIM 100005
#define f first
#define s second
using namespace std;
static int viz[DIM];
static pair<int, int> d[DIM];
static vector< pair<int, int> > v[DIM];
int travel_plan(int n, int m, int r[][2], int L[], int k, int p[]){
    int i, nod, ii, vecin;
    for(i = 1; i <= n; i++){
        d[i].f = d[i].s = 1000000000;
    }
    for(i = 0; i < k; i++){
        p[i]++;
        d[ p[i] ] = make_pair(0, 0);
    }
    for(i = 0; i < m; i++){
        r[i][0]++; r[i][1]++;
        v[ r[i][0] ].push_back( make_pair(r[i][1], L[i]) );
        v[ r[i][1] ].push_back( make_pair(r[i][0], L[i]) );
    }
    d[0].s = 1000000001;
    for(ii = 1; ii <= n; ii++){
        nod = 0;
        for(i = 1; i <= n; i++){
            if(viz[i] == 0 && d[nod].s > d[i].s){
                nod = i;
            }
        }
        viz[nod] = 1;
        for(i = 0; i < v[nod].size(); i++){
            vecin = v[nod][i].f;
            if(d[vecin].f > d[nod].s + v[nod][i].s){
                d[vecin].s = d[vecin].f;
                d[vecin].f = d[nod].s + v[nod][i].s;
            }
            else{
                if(d[vecin].s > d[nod].s + v[nod][i].s){
                    d[vecin].s = d[nod].s + v[nod][i].s;
                }
            }
        }
    }
    return d[1].s;
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:34:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(i = 0; i < v[nod].size(); i++){
                    ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 2680 KB Output is correct
2 Correct 6 ms 2680 KB Output is correct
3 Correct 7 ms 2680 KB Output is correct
4 Correct 9 ms 2808 KB Output is correct
5 Correct 9 ms 2808 KB Output is correct
6 Correct 8 ms 2680 KB Output is correct
7 Correct 9 ms 2808 KB Output is correct
8 Correct 9 ms 2808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 2680 KB Output is correct
2 Correct 6 ms 2680 KB Output is correct
3 Correct 7 ms 2680 KB Output is correct
4 Correct 9 ms 2808 KB Output is correct
5 Correct 9 ms 2808 KB Output is correct
6 Correct 8 ms 2680 KB Output is correct
7 Correct 9 ms 2808 KB Output is correct
8 Correct 9 ms 2808 KB Output is correct
9 Correct 9 ms 3064 KB Output is correct
10 Correct 7 ms 2680 KB Output is correct
11 Correct 8 ms 2808 KB Output is correct
12 Correct 11 ms 3108 KB Output is correct
13 Correct 10 ms 3192 KB Output is correct
14 Correct 7 ms 2680 KB Output is correct
15 Correct 8 ms 2808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 2680 KB Output is correct
2 Correct 6 ms 2680 KB Output is correct
3 Correct 7 ms 2680 KB Output is correct
4 Correct 9 ms 2808 KB Output is correct
5 Correct 9 ms 2808 KB Output is correct
6 Correct 8 ms 2680 KB Output is correct
7 Correct 9 ms 2808 KB Output is correct
8 Correct 9 ms 2808 KB Output is correct
9 Correct 9 ms 3064 KB Output is correct
10 Correct 7 ms 2680 KB Output is correct
11 Correct 8 ms 2808 KB Output is correct
12 Correct 11 ms 3108 KB Output is correct
13 Correct 10 ms 3192 KB Output is correct
14 Correct 7 ms 2680 KB Output is correct
15 Correct 8 ms 2808 KB Output is correct
16 Execution timed out 2045 ms 56256 KB Time limit exceeded
17 Halted 0 ms 0 KB -