Submission #699794

# Submission time Handle Problem Language Result Execution time Memory
699794 2023-02-18T03:28:24 Z Zybg Easter Eggs (info1cup17_eastereggs) C++11
0 / 100
245 ms 131072 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;
vector<int> gr[520], order;

void dfs(int u,int pre){
	order.push_back(u);
	for(int i : gr[u]){
		if(i == pre) continue;
		dfs(i,u);
	}
}

int findEgg (int N, vector < pair < int, int > > bridges)
{
    for(auto pii : bridges){
    	gr[pii.first].push_back(pii.second);
    	gr[pii.second].push_back(pii.first);
	}
	dfs(1,0);
	int l = 0, r = N-1;
	
	while(l < r){
		int mid = l+r+1 >> 1;
		if(query(vector<int>(order.begin(),order.begin()+mid))) r = mid-1;
		else l = mid;
	}
	return order[l];
	
	return 0; 
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:25:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   25 |   int mid = l+r+1 >> 1;
      |             ~~~^~
# Verdict Execution time Memory Grader output
1 Runtime error 245 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 209 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 198 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -