답안 #120926

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
120926 2019-06-25T18:17:43 Z Runtime_error_ 악어의 지하 도시 (IOI11_crocodile) C++14
0 / 100
5 ms 2816 KB
#include <vector>
#include <queue>
#include <utility>
#include <bits/stdc++.h>
#include "crocodile.h"
using namespace std;
typedef pair<int,int> pi;
 
int v0[100005], v1[100005];
//priority_queue<pi,vector<pi>,greater<pi> > pq;
set<pi>s;
vector<pi> graph[100005];
 
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
    for (int i=0; i<M; i++) {
        graph[R[i][0]].push_back(pi(L[i],R[i][1]));
        graph[R[i][1]].push_back(pi(L[i],R[i][0]));
    }
    for (int i=0; i<K; i++) {
        v0[P[i]] = 1;
        s.insert( make_pair(0,P[i]) );
        //pq.push(pi(0,P[i]));
    }
    while (!s.empty()) {
        pi x = *s.begin();
      	s.erase(s.begin());
        if(v0[x.second] == 0){
            v0[x.second] = 1;
            continue;
        }
        if(v1[x.second]) continue;
        v1[x.second] = 1;
        if(x.second == 0) return x.first;
        for (int i=0; i<graph[x.second].size(); i++) {
            pi t = graph[x.second][i];
            if(v1[t.second]) continue;
            s.insert(make_pair(t.first+x.first,t.second));
        }
    }
    return -1;
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:34:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i=0; i<graph[x.second].size(); i++) {
                       ~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2688 KB Output is correct
2 Correct 5 ms 2688 KB Output is correct
3 Correct 4 ms 2688 KB Output is correct
4 Incorrect 5 ms 2816 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2688 KB Output is correct
2 Correct 5 ms 2688 KB Output is correct
3 Correct 4 ms 2688 KB Output is correct
4 Incorrect 5 ms 2816 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2688 KB Output is correct
2 Correct 5 ms 2688 KB Output is correct
3 Correct 4 ms 2688 KB Output is correct
4 Incorrect 5 ms 2816 KB Output isn't correct
5 Halted 0 ms 0 KB -