Submission #691889

# Submission time Handle Problem Language Result Execution time Memory
691889 2023-01-31T22:01:04 Z Ahmed_Solyman Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
2 ms 464 KB
#include <bits/stdc++.h>
#include <ext/rope>
 
using namespace std;
using namespace __gnu_cxx;
#pragma GCC optimize("-Ofast")
#pragma GCC optimize("-O1")
//-------------------------------------------------------------//
typedef long long ll;
typedef unsigned long long ull;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define sum_to(n) (n*(n+1))/2
#define pb push_back
#define pf push_front
#define sz size()
#define fil(arr,x) memset(arr,x,sizeof(arr))
const ll mod=1e9+7;
int dx[8]={0,1,0,-1,1,1,-1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
//-------------------------------------------------------------//
ll lcm(ll a,ll b)
{
    return (max(a,b)/__gcd(a,b))*min(a,b);
}
void person_bool(bool x)
{
    cout<<(x?"YES":"NO")<<endl;
}
vector<int>v;
int query(vector<int>v);
int findEgg(int n,vector<pair<int,int>>f){
	vector<int>adj[n+5];
	for(auto i:f){
		adj[i.first].pb(i.second);
		adj[i.second].pb(i.first);
	}
	queue<int>q;
	q.push(1);
	vector<bool>vis(n+5);
	while(q.sz){
		int x=q.front();
		q.pop();v.pb(x);
		vis[x]=1;
		for(auto i:adj[x]){
			if(!vis[i]){
				q.push(i);
			}
		}
	}
	int l=1,r=n;
	int ans=0;
	while(l<=r){
		int mid=(l+r)/2;
		vector<int>g;
		for(int i=0;i<mid;i++){
			g.pb(v[i]);
		}
		if(query(g)){
			r=mid-1;
		}
		else{
			ans=mid;
			l=mid+1;
		}
	}
	return v[ans+1];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -