東京大学プログラミングコンテスト2014

Submission #6919899

Source codeソースコード

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

Task問題 C - 最小カットと最大カット
User nameユーザ名 tsb2b
Created time投稿日時
Language言語 C++ (GCC 5.4.1)
Status状態 CE
Score得点 -
Source lengthソースコード長 433 Byte
File nameファイル名
Exec time実行時間 -
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./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));
^

Test case