Submission #236282

#TimeUsernameProblemLanguageResultExecution timeMemory
236282MasterdanCrocodile's Underground City (IOI11_crocodile)C++14
0 / 100
5 ms384 KiB
#include "crocodile.h" #include <bits/stdc++.h> #define F first #define S second #define pb push_back #define MAX 1e9+7 #define MIN -1 #define all(a) a.begin (), a.end () #define mem(a, c) memset(a, c, sizeof a) #define mk make_pair using namespace std; typedef vector <int> vi; typedef pair<int, int> ii; typedef long long int ll; typedef pair<ll, ll> pll; typedef vector <ii> vii; typedef vector<vi> vvi; typedef double db; typedef priority_queue<int,vi, greater<int> > pq; vector<vii> G; int hojas[1010], vis[1010]; int solve(int x){ vis[x]=1; if(hojas[x]==1){ return 0; } pq formas; for(int i=0;i<G[x].size ();i++){ ii v=G[x][i]; int child=v.F, peso=v.S; int aux; if(vis[child]==0)aux=peso+solve(child); formas.push(aux); } formas.pop(); return formas.top(); } int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) { G=vector<vii > (n+2); for(int i=0;i<m;i++){ int x=r[i][0]; int y=r[i][1]; G[x].pb(mk(y, l[i])); G[y].pb(mk(x, l[i])); } mem(hojas, 0); for(int i=0;i<k;i++)hojas[p[i]]=1; mem(vis, 0); int ans=solve(0); return ans; }/* #define MAX_N 50000 #define MAX_M 10000000 static int N, M; static int R[MAX_M][2]; static int L[MAX_M]; static int K; static int P[MAX_N]; static int solution; inline void my_assert(int e) {if (!e) abort();} void read_input() { int i; my_assert(3==scanf("%d %d %d",&N,&M,&K)); for(i=0; i<M; i++) my_assert(3==scanf("%d %d %d",&R[i][0],&R[i][1],&L[i])); for(i=0; i<K; i++) my_assert(1==scanf("%d",&P[i])); my_assert(1==scanf("%d",&solution)); } int main() { int ans; read_input(); ans = travel_plan(N,M,R,L,K,P); if(ans==solution) printf("Correct.\n"); else printf("Incorrect. Returned %d, Expected %d.\n",ans,solution); return 0; } */

Compilation message (stderr)

crocodile.cpp: In function 'int solve(int)':
crocodile.cpp:28:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<G[x].size ();i++){
                 ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...