Submission #61605

# Submission time Handle Problem Language Result Execution time Memory
61605 2018-07-26T08:01:34 Z minhcool Easter Eggs (info1cup17_eastereggs) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;

const int N = 515;
int ck[N], cur, num;
vector<int> Adjlist[N], check;

void dfs(int u, int p){
	if(cur == num) return;
	if(ck[u]){
		cur++;
		check.push_back(u);
	}
	for(auto v: Adjlist[u]){
		if(v != p){
			dfs(v, u);
		}
	}
}

void findEgg(int N, vector<pair<int, int>> bridges){
	memset(ck, 1, sizeof ck);
	int n = N, cnt;
	for(int i = 0; i < n; i++){
		bridges.first.push_back(bridges.second);
		bridges.second.push_back(bridges.first);
	}
	num = n;
	while(num != 1){
		cnt = (num + 1) / 2;
		check.clear();
		cur = 0;
		dfs(1, 1);
		if(query(check)){
			for(int i = 1; i <= n; i++) ck[i] = 0;
			for(int i = 0; i < check.size(); i++) ck[check[i]] = 1;
			cnt = num;
		}
		else{
			for(int i = 0; i < check.size(); i++) ck[check[i]] = 0;
			cnt -= num;
		}
	}
	for(int i = 1; i <= n; i++) if(ck[i]) return i;
}

Compilation message

eastereggs.cpp: In function 'void findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:22:6: error: ambiguating new declaration of 'void findEgg(int, std::vector<std::pair<int, int> >)'
 void findEgg(int N, vector<pair<int, int>> bridges){
      ^~~~~~~
In file included from eastereggs.cpp:2:0:
grader.h:5:5: note: old declaration 'int findEgg(int, std::vector<std::pair<int, int> >)'
 int findEgg(int N, vector < pair < int, int > > bridges);
     ^~~~~~~
eastereggs.cpp:26:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
   bridges.first.push_back(bridges.second);
           ^~~~~
eastereggs.cpp:26:35: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'; did you mean 'cend'?
   bridges.first.push_back(bridges.second);
                                   ^~~~~~
                                   cend
eastereggs.cpp:27:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'; did you mean 'cend'?
   bridges.second.push_back(bridges.first);
           ^~~~~~
           cend
eastereggs.cpp:27:36: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
   bridges.second.push_back(bridges.first);
                                    ^~~~~
eastereggs.cpp:37:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i = 0; i < check.size(); i++) ck[check[i]] = 1;
                   ~~^~~~~~~~~~~~~~
eastereggs.cpp:41:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i = 0; i < check.size(); i++) ck[check[i]] = 0;
                   ~~^~~~~~~~~~~~~~
eastereggs.cpp:45:47: error: return-statement with a value, in function returning 'void' [-fpermissive]
  for(int i = 1; i <= n; i++) if(ck[i]) return i;
                                               ^