답안 #82548

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
82548 2018-10-31T12:25:49 Z farukkastamonuda 통행료 (IOI18_highway) C++14
컴파일 오류
0 ms 0 KB
#include "highway.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long 
#define inf 1000000009
#define md 1000000007
#define li 105;
#define mp make_pair
#define pb push_back
#define mid (start+end)/2
using namespace std;
lo dep,dep2;
int baba[li],atakenar[li],tut;
vector< pair<int,int> > v[li];
vector<int> val,ol;
int yol[105];
void dfs(int node,int ata,int der){
	baba[node]=ata;
	if(der==dep) ol.pb(node);
	for(int i=0;i<(int)v[node].size();i++){
		int go=v[node][i].fi;
		atakenar[go]=v[node][i].se;
		if(go==ata) continue;
		dfs(go,node,der+1);
	}
}
void git(int a,int b){
	while(b!=a){
		yol[atakenar[b]]=1;
		b=baba[b];
	}
	//yol.pb(a);
}
void find_pair(int N,vector<int> U,vector<int> V,int A,int B){
	for(int i=0;i<(int)U.size();i++){
		v[U[i]].pb(mp(V[i],i));
		v[V[i]].pb(mp(U[i],i));
	}
	for(int i=1;i<=N;i++) val.pb(0);
	dep=ask(val);
	val.clear();
	for(int i=1;i<=N;i++) val.pb(1);
	dep2=ask(val);
	dfs(0,-1,0);
	//val.clear();
	for(int i=0;i<(int)ol.size();i++){
		val.clear();
		memset(yol,0,sizeof(yol));
		git(0,ol[i]);
		for(int j=0;j<(int)U.size();j++){
			if(yol[j]==1) val.pb(1);
			else val.pb(0);
		}
		if(ask(val)==dep2){
			tut=ol[i];
			break;
		}
	}
	answer(0,tut);
}

Compilation message

highway.cpp:8:15: error: expected ']' before ';' token
 #define li 105;
               ^
highway.cpp:14:10: note: in expansion of macro 'li'
 int baba[li],atakenar[li],tut;
          ^~
highway.cpp:14:12: error: expected unqualified-id before ']' token
 int baba[li],atakenar[li],tut;
            ^
highway.cpp:14:25: error: expected unqualified-id before ']' token
 int baba[li],atakenar[li],tut;
                         ^
highway.cpp:8:15: error: expected ']' before ';' token
 #define li 105;
               ^
highway.cpp:15:27: note: in expansion of macro 'li'
 vector< pair<int,int> > v[li];
                           ^~
highway.cpp:15:29: error: expected unqualified-id before ']' token
 vector< pair<int,int> > v[li];
                             ^
highway.cpp: In function 'void dfs(int, int, int)':
highway.cpp:19:2: error: 'baba' was not declared in this scope
  baba[node]=ata;
  ^~~~
highway.cpp:19:2: note: suggested alternative: 'ata'
  baba[node]=ata;
  ^~~~
  ata
highway.cpp:21:21: error: 'v' was not declared in this scope
  for(int i=0;i<(int)v[node].size();i++){
                     ^
highway.cpp:23:3: error: 'atakenar' was not declared in this scope
   atakenar[go]=v[node][i].se;
   ^~~~~~~~
highway.cpp:23:3: note: suggested alternative: 'atanl'
   atakenar[go]=v[node][i].se;
   ^~~~~~~~
   atanl
highway.cpp: In function 'void git(int, int)':
highway.cpp:30:7: error: 'atakenar' was not declared in this scope
   yol[atakenar[b]]=1;
       ^~~~~~~~
highway.cpp:30:7: note: suggested alternative: 'atanl'
   yol[atakenar[b]]=1;
       ^~~~~~~~
       atanl
highway.cpp:31:5: error: 'baba' was not declared in this scope
   b=baba[b];
     ^~~~
highway.cpp:31:5: note: suggested alternative: 'labs'
   b=baba[b];
     ^~~~
     labs
highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:37:3: error: 'v' was not declared in this scope
   v[U[i]].pb(mp(V[i],i));
   ^
highway.cpp:56:4: error: 'tut' was not declared in this scope
    tut=ol[i];
    ^~~
highway.cpp:60:11: error: 'tut' was not declared in this scope
  answer(0,tut);
           ^~~