Submission #226024

# Submission time Handle Problem Language Result Execution time Memory
226024 2020-04-22T10:52:01 Z cfalas Crocodile's Underground City (IOI11_crocodile) C++14
0 / 100
10 ms 512 KB
#include<bits/stdc++.h>
using namespace std;
#include "crocodile.h"
#define F first
#define S second
#define ll long long
typedef pair<ll, ll> ii;
typedef vector<ii> vii;

int ans=0;
vector<vii> adj;
bool vis[1000000];
bool nice[1000000];
bool dfs(int s){
	cout<<s<<" ";
	vis[s] = true;
	if(nice[s]) return true;
	cout<<adj[s].size()<<endl;
	int ind=0;
	int cnt=0;
	for(auto x : adj[s]){
		//cout<<" "<<x.S<<" "<<vis[x.S]<<endl;
		if(!vis[x.S]) cnt++;
		if(cnt==2) break;
		ind++;
	}
	//cout<<ind<<endl;
	if(ind!=0){
		ans+=adj[s][ind].F;
		if(dfs(adj[s][ind].S)) return true;

	}
	return false;
}

int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) {
	adj.assign(n+1, vii());
	for(int i=0;i<m;i++){
		adj[r[i][0]].push_back(ii(l[i], r[i][1]));
		adj[r[i][1]].push_back(ii(l[i], r[i][0]));
	}
	for(int i=0;i<n;i++){
		sort(adj[i].begin(), adj[i].end());
	}
	dfs(0);
	return ans;
}


# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -