Submission #236294

#TimeUsernameProblemLanguageResultExecution timeMemory
236294MasterdanCrocodile'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 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, int vis[], vector <vii> G, int hojas[]){ vis[x]=1; if(hojas[x]==1){ return 0; } vi 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, vis, G, hojas); formas.pb(aux); } sort(all(formas)); return formas[1]; } int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) { G=vector <vii> (n+5); 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, vis, G, hojas); return ans; }/* #include "crocodile.h" #include <stdio.h> #include <stdlib.h> #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, int*, std::vector<std::vector<std::pair<int, int> > >, int*)':
crocodile.cpp:27: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...