답안 #243028

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
243028 2020-06-30T08:00:37 Z soyeon_ss Easter Eggs (info1cup17_eastereggs) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define for1(i, a, b) for(i = a; i <= b; ++i)
#define for0(i, a, b) for(i = a; i < b; ++i)
#define forw1(i, a, b) for(i = a; i >= b; --i)
#define forw0(i, a, b) for(i = a - 1; i >= b; --i)
#define fora(v, a) for(auto v : a)
#define bp __builtin_popcount
#define bpll __builtin_popcountll

using namespace std;
using cd = complex<double>;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<cd> vcd;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int modd1 = 1e9 + 7, modd2 = 998244353, maxn = 520, K = 26, inf = 1e9, infll = 1e18;
const double pi = acos(-1);
int n, m, used[maxn];
vi gr[maxn], tp;

void dfs(int st){
	used[st] = 1;
	tp.pb(st);
	int i, j, k, l, r;
	for0(i, 0, (int)gr[st].size()){
		if(!used[gr[st][i]]){
			dfs(gr[st][i]);
		}
	}
}

int binsearch(int lo, int hi){
	if(lo == hi){
		return lo;
	}
	int mid = (lo + hi) >> 1;
	int i, j, k, l, r; vi que;
	for1(i, 0, mid){
		que.pb(tp[i]);
	}
	if(query(que)){
		return binsearch(lo, mid);
	}
	else{
		return binsearch(mid + 1, hi);
	}
}

int findEgg(int N, vii bridges){
	int i, j, k, l, r;
	for0(i, 1, N){
		gr[bridges[i - 1].fi].pb(bridges[i - 1].se);
		gr[bridges[i - 1].se].pb(bridges[i - 1].fi);
	}
	dfs(1);
	return tp[binsearch(0, n - 1)];
}

Compilation message

eastereggs.cpp: In function 'void dfs(long long int)':
eastereggs.cpp:33:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j, k, l, r;
         ^
eastereggs.cpp:33:12: warning: unused variable 'k' [-Wunused-variable]
  int i, j, k, l, r;
            ^
eastereggs.cpp:33:15: warning: unused variable 'l' [-Wunused-variable]
  int i, j, k, l, r;
               ^
eastereggs.cpp:33:18: warning: unused variable 'r' [-Wunused-variable]
  int i, j, k, l, r;
                  ^
eastereggs.cpp: In function 'long long int binsearch(long long int, long long int)':
eastereggs.cpp:50:5: error: 'query' was not declared in this scope
  if(query(que)){
     ^~~~~
eastereggs.cpp:50:5: note: suggested alternative: 'que'
  if(query(que)){
     ^~~~~
     que
eastereggs.cpp:46:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j, k, l, r; vi que;
         ^
eastereggs.cpp:46:12: warning: unused variable 'k' [-Wunused-variable]
  int i, j, k, l, r; vi que;
            ^
eastereggs.cpp:46:15: warning: unused variable 'l' [-Wunused-variable]
  int i, j, k, l, r; vi que;
               ^
eastereggs.cpp:46:18: warning: unused variable 'r' [-Wunused-variable]
  int i, j, k, l, r; vi que;
                  ^
eastereggs.cpp: In function 'long long int findEgg(long long int, vii)':
eastereggs.cpp:59:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j, k, l, r;
         ^
eastereggs.cpp:59:12: warning: unused variable 'k' [-Wunused-variable]
  int i, j, k, l, r;
            ^
eastereggs.cpp:59:15: warning: unused variable 'l' [-Wunused-variable]
  int i, j, k, l, r;
               ^
eastereggs.cpp:59:18: warning: unused variable 'r' [-Wunused-variable]
  int i, j, k, l, r;
                  ^
eastereggs.cpp: In function 'long long int binsearch(long long int, long long int)':
eastereggs.cpp:56:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^