답안 #900313

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
900313 2024-01-08T06:12:36 Z Muhammad_Aneeq 악어의 지하 도시 (IOI11_crocodile) C++17
0 / 100
2000 ms 5212 KB
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int const MAXN=1e5+10;
vector<pair<int,int>>nei[MAXN]={};
bool ex[MAXN]={};
bool vis[MAXN]={};
bool comp(pair<int,int>a,pair<int,int>b)
{
	return (a.second<=b.second);
}
int dfs(int n,int val)
{
	if (ex[n])
		return val;
	vis[n]=1;
	vector<int>g;
	for (auto [j,w]:nei[n])
	{
		int f=1e9+10;
		if (vis[j])
			continue;
		for (auto [i,w1]:nei[n])
		{
			if (i==j&&w==w1)
				continue;
			if (!vis[i])
				f=min(f,dfs(i,val+w1));
		}
		g.push_back(f);
	}
	vis[n]=0;
	sort(begin(g),end(g));
	return g.back();
}
int ans=1e9+10;

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
	for (int i=0;i<M;i++)
	{
		nei[R[i][0]].push_back({R[i][1],L[i]});
		nei[R[i][1]].push_back({R[i][0],L[i]});
	}
	for  (int i=0;i<K;i++)
		ex[P[i]]=1;
	for (int i=0;i<N;i++)
		sort(begin(nei[i]),end(nei[i]),comp);
	return dfs(0,0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 5212 KB Output is correct
2 Correct 1 ms 5212 KB Output is correct
3 Correct 2 ms 5212 KB Output is correct
4 Correct 2 ms 5212 KB Output is correct
5 Correct 6 ms 5212 KB Output is correct
6 Execution timed out 2090 ms 5212 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 5212 KB Output is correct
2 Correct 1 ms 5212 KB Output is correct
3 Correct 2 ms 5212 KB Output is correct
4 Correct 2 ms 5212 KB Output is correct
5 Correct 6 ms 5212 KB Output is correct
6 Execution timed out 2090 ms 5212 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 5212 KB Output is correct
2 Correct 1 ms 5212 KB Output is correct
3 Correct 2 ms 5212 KB Output is correct
4 Correct 2 ms 5212 KB Output is correct
5 Correct 6 ms 5212 KB Output is correct
6 Execution timed out 2090 ms 5212 KB Time limit exceeded
7 Halted 0 ms 0 KB -