답안 #165602

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
165602 2019-11-27T15:12:40 Z Peacher29 악어의 지하 도시 (IOI11_crocodile) C++14
100 / 100
1139 ms 66368 KB
#include "crocodile.h"
#include<bits/stdc++.h>

using namespace std;

class pont{
public:
	vector<int> hova;
	vector<int> mennyiert;
	long long elso=INT_MAX;
	long long masodik=INT_MAX;
	bool volt=0;
};

vector<pont> p;
priority_queue<pair<int,int>> pq;

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
	p.resize(N);
	for(int i=0;i<M;i++){
		p[R[i][0]].hova.push_back(R[i][1]);
		p[R[i][1]].hova.push_back(R[i][0]);
		p[R[i][0]].mennyiert.push_back(L[i]);
		p[R[i][1]].mennyiert.push_back(L[i]);
	}
	for(int i=0;i<K;i++){
		p[P[i]].elso=0;
		p[P[i]].masodik=0;
		pq.push({0,P[i]});
	}
	while(!pq.empty()){
		int ind = pq.top().second;
		if(!p[ind].volt) {
			p[ind].volt=1;
			for(int i = 0; i < p[ind].hova.size() ; i ++){
				int hov = p[ind].hova[i];
				if(p[hov].elso > max(p[hov].masodik, p[ind].mennyiert[i] + p[ind].elso)){
					p[hov].elso = max(p[hov].masodik, p[ind].mennyiert[i] + p[ind].elso);
					pq.push({-p[hov].elso,hov});
				}
				if(p[hov].masodik > p[ind].mennyiert[i] + p[ind].elso){
					p[hov].masodik = p[ind].mennyiert[i] + p[ind].elso;
				}
			}
		}
		pq.pop();
	}
	/*for(int i=0;i<N;i++){
		cout << i << ' ' << p[i].elso << ' ' << p[i].masodik << " ; ";
		for(int j : p[i].mennyiert){
			cout << j << ' ';
		}
		cout << '\n';
	}*/
return p[0].elso;
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:35:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i = 0; i < p[ind].hova.size() ; i ++){
                   ~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 552 KB Output is correct
9 Correct 4 ms 632 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 504 KB Output is correct
12 Correct 7 ms 760 KB Output is correct
13 Correct 5 ms 888 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 552 KB Output is correct
9 Correct 4 ms 632 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 504 KB Output is correct
12 Correct 7 ms 760 KB Output is correct
13 Correct 5 ms 888 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 988 ms 57208 KB Output is correct
17 Correct 118 ms 19292 KB Output is correct
18 Correct 153 ms 20952 KB Output is correct
19 Correct 1139 ms 66368 KB Output is correct
20 Correct 370 ms 48064 KB Output is correct
21 Correct 55 ms 7724 KB Output is correct
22 Correct 413 ms 46128 KB Output is correct