답안 #243051

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
243051 2020-06-30T08:20:24 Z Xenocryptix Easter Eggs (info1cup17_eastereggs) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;

#define first fi
#define second se
#define push_back pb
vector<int> g[10000], q;

void dfs(int u, int f = -1) {
	q.pb(u);
	for(int i: g[u])
		if(i != f)
			dfs(i, u)
}

int bin_search(int l, int r) {
	while(l < r) {
		m = (l + r) >> 1;
		if(query(vector<int>(q.begin(), q.begin() + m)))
            r = m;
        else
            l = m + 1;
	}
	return l;
}

int findEgg(int N, vector< pair<int, int> > bridges) {
	for(auto i: bridges) {
		g[i.fi].pb(i.se);
		g[i.se].pb(i.fi);
	}
	dfs(1);
	return q[bin_search(1, N) - 1];
}

Compilation message

eastereggs.cpp: In function 'void dfs(int, int)':
eastereggs.cpp:11:4: error: 'class std::vector<int>' has no member named 'pb'
  q.pb(u);
    ^~
eastereggs.cpp:15:1: error: expected ';' before '}' token
 }
 ^
eastereggs.cpp: In function 'int bin_search(int, int)':
eastereggs.cpp:19:3: error: 'm' was not declared in this scope
   m = (l + r) >> 1;
   ^
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:30:7: error: 'struct std::pair<int, int>' has no member named 'fi'
   g[i.fi].pb(i.se);
       ^~
eastereggs.cpp:30:16: error: 'struct std::pair<int, int>' has no member named 'se'
   g[i.fi].pb(i.se);
                ^~
eastereggs.cpp:31:7: error: 'struct std::pair<int, int>' has no member named 'se'
   g[i.se].pb(i.fi);
       ^~
eastereggs.cpp:31:16: error: 'struct std::pair<int, int>' has no member named 'fi'
   g[i.se].pb(i.fi);
                ^~