Submission #242992

# Submission time Handle Problem Language Result Execution time Memory
242992 2020-06-30T07:07:07 Z minhcool Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
400 ms 131076 KB
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;

#define fi first
#define se second
#define pb push_back

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

vector<int> euler;
vector<int> Adjlist[100005];

void dfs(int u, int p){
	euler.pb(u);
	for(int i = 0; i < Adjlist[u].size(); i++){
		int v = Adjlist[u][i];
		if(v == p) continue;
		dfs(v, u);
	}
}

int findEgg(int N, vector<ii> bridges){
	for(int i = 0; i < bridges.size(); i++){
		Adjlist[bridges[i].fi].pb(bridges[i].se);
		Adjlist[bridges[i].se].pb(bridges[i].fi);
	}
	dfs(1, 1);
	int l = 0, r = N - 1;
	while(l != r){
		int mid = (l + r) >> 1;
		vector<int> nodes;
		nodes.clear();
		for(int i = 0; i <= mid; i++) nodes.pb(euler[i]);
		if(query(nodes)) r = mid;
		else l = mid + 1;
	}
	return euler[l];
}

Compilation message

eastereggs.cpp: In function 'void dfs(int, int)':
eastereggs.cpp:18:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < Adjlist[u].size(); i++){
                 ~~^~~~~~~~~~~~~~~~~~~
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:26:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < bridges.size(); i++){
                 ~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 421 ms 131072 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 297 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 298 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -