Submission #1083145

# Submission time Handle Problem Language Result Execution time Memory
1083145 2024-09-02T16:38:33 Z rayan_bd Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; 


#define getar(ar,n) for(ll i=0;i<n;++i) cin>>ar[i]
#define show(n) cout<<n<<'\n'
#define all(v) v.begin(), v.end()
#define br cout<<"\n"
#define pb push_back
#define nl '\n'
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define ret return
#define ll long long
#define ld long double
#define sza(x) ((int)x.size())

const int mxN = 5000;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ld EPS = 1e-9;

vector<pair<int,int>> adj[mxN];
int ans=1e9;
vector<bool> exitt(mxN,0);

void dfs(int u=0,int par=-1,int upp=0,bool seen=0){
	bool leaf=0;
	for(auto it:adj[u]){
		if(it.first^par){
			dfs(it.first,u,(!seen?upp+it.second:upp),seen||exitt[it.first]);
		}
	}
	if(leaf&&seen){
		ans=min(ans,upp);
	}
}

int travel_plan(int n,int m,int r[][2],int l[],int k,int p[]){
	for(int i=0;i<m;++i){
		ll u=r[i][0],v=r[i][1],w=l[i];
		adj[u].pb({v,w});
		adj[v].pb({u,w});
	}
	for(int i=0;i<k;++i) exitt[p[i]]=1;
	dfs();
	return ans;
}

/*int main() {
    
    #ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    #endif

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    


    return 0;
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -