답안 #29048

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
29048 2017-07-18T07:39:19 Z dereotu 악어의 지하 도시 (IOI11_crocodile) C++14
0 / 100
466 ms 262144 KB
#include "crocodile.h"
#include <bits/stdc++.h>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define forr(i,A,B) for(int i=A;i<B;++i)
#define space ' '
#define endl '\n'
#define LL long long
#define exit adsjdsa
using namespace std;
//kaçışlar leaf
//her node için en büyük ikiyi tut 
//vector < ii > adj[1005];
int exit[1005];
int adj[1005][1005];
vector <int> nodes[1005];

void dfs(int x,int y){
	if(exit[x]){
		nodes[x].pb(adj[x][y]);
		return;
	}
	forr(i,0,1005){
		if(adj[x][i]!=0 and i!=y){
			dfs(i,x);
		}
	}
	forr(i,0,1005){
		if(adj[x][i]!=0 and i!=y){
			forr(j,0,nodes[i].size()){
				nodes[x].pb(nodes[i][j]);
			}
		}
	}
}

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
	forr(i,0,M){
		//adj[R[i][0]].pb(mp(L[i],R[i][1]));
		//adj[R[i][1]].pb(mp(L[i],R[i][0]));
		adj[R[i][0]][R[i][1]]=L[i];
		adj[R[i][1]][R[i][0]]=L[i];
	}
	forr(i,0,K){
		exit[P[i]]=1;
	}
	dfs(0,-1);
	forr(i,0,nodes[0].size()){
		//cout<<nodes[0][i]<<endl;
	}
	sort(nodes[0].begin(),nodes[0].end(),greater<int>());
	int ans=nodes[0][1];
	return ans;
}


Compilation message

crocodile.cpp: In function 'void dfs(int, int)':
crocodile.cpp:8:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define forr(i,A,B) for(int i=A;i<B;++i)
                                  ^
crocodile.cpp:33:4: note: in expansion of macro 'forr'
    forr(j,0,nodes[i].size()){
    ^
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:8:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define forr(i,A,B) for(int i=A;i<B;++i)
                                  ^
crocodile.cpp:51:2: note: in expansion of macro 'forr'
  forr(i,0,nodes[0].size()){
  ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 123380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Memory limit exceeded 69 ms 262144 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 466 ms 123380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -