Submission #6919899


Source Code Expand

int N;
int D[101000];
vector<int> E[101000];
int ng,ml;

void dfs(int cur,int dep) {
	int i;
	D[cur]=dep;
	FORR(r,E[cur]) {
		if(D[r]==-1) dfs(r,dep+1);
		else if(D[r]<D[cur]-1) ml=max(ml,(D[cur]+1-D[r]));
	}
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	cin>>N;
	
	FOR(i,N) {
		cin>>x>>y;
		E[x-1].push_back(y-1);
		E[y-1].push_back(x-1);
	}
	MINUS(D);
	dfs(0,0);
	
	_P("%d %d\n",1+(ml==N),N-(ml%2));
}

Submission Info

Submission Time
Task C - 最小カットと最大カット
User tsb2b
Language C++ (GCC 5.4.1)
Score 0
Code Size 433 Byte
Status CE

Compile Error

./Main.cpp:3:1: error: ‘vector’ does not name a type
 vector<int> E[101000];
 ^
./Main.cpp: In function ‘void dfs(int, int)’:
./Main.cpp:9:7: error: ‘r’ was not declared in this scope
  FORR(r,E[cur]) {
       ^
./Main.cpp:9:9: error: ‘E’ was not declared in this scope
  FORR(r,E[cur]) {
         ^
./Main.cpp:9:15: error: ‘FORR’ was not declared in this scope
  FORR(r,E[cur]) {
               ^
./Main.cpp: In function ‘void solve()’:
./Main.cpp:16:21: error: ‘string’ was not declared in this scope
  int i,j,k,l,r,x,y; string s;
                     ^
./Main.cpp:17:2: error: ‘cin’ was not declared in this scope
  cin>>N;
  ^
./Main.cpp:19:9: error: ‘FOR’ was not declared in this scope
  FOR(i,N) {
         ^
./Main.cpp:24:9: error: ‘MINUS’ was not declared in this scope
  MINUS(D);
         ^
./Main.cpp:27:33: error: ‘_P’ was not declared in this scope
  _P("%d %d\n",1+(ml==N),N-(ml%2));
                                 ^