답안 #970969

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
970969 2024-04-27T16:14:02 Z jhon06 Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
2 ms 520 KB
#include<bits/stdc++.h>
//#include<bits/extc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define maxl 1e18
#define minl -(1e18)
#define lb lower_bound
#define ub upper_bound
#define bg begin()
#define nd end()
#define rnd(x) random_shuffle((x).begin, (x).end())
#define reverse(x) reverse((x).begin(), (x).end())
#define del erase
#define ssub substr
#define tp tuple
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define vi vector<ll>
#define vii vector<pair<ll,ll>>
#define lsb(x) (x&(-x))
#define log2(i) (__builtin_clzll(1) - __builtin_clzll(i))
#define gcd(a,b) __gcd(a,b)
#define bits(a) __builtin_popcountll(a)
#define lcm(a,b) ((a*b)/gcd(a,b))
#define dbg(x) (cerr<<"["<<"R"<<":"<<__LINE__<<"]"<<#x<<" -> "<<(x)<<'\n',(x))
#define remDup(x) sort(all(x));x.erase(unique(all(x)),(x).end())
// #define rand (rand() * (RAND_MAX + 1) + rand()) % (int)1e6
#define count(x) __builtin_popcount(x)
//nth elemtnh
 
const int fi[]={+1,0,-1,+0};
const int fj[]={+0,-1,0,+1};
bool valid(int i,int j,int n,int m){
	return i>=0 && j>=0 && i<n && j<m;
}
//g++ main.cpp -o a -Wall -Wextra -Wshadow -fsanitize=address,undefined -ggdb3 -fmax-errors=10 -02
//cout << setprecision(10) << fixed << sol << '\n'; se voglio specificare precisione
//lower_bound(arr,arr+a,valore); unique() remove dups fill(vec,number) merge() binary_search()
//(p % n + n) % n
//order_of_key(n), find_by_order(n) , size( //0 based
//strstr  per trovare se sottostringa appare in stringa 0(n)
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
using namespace std;
int query(vector < int > islands);
vector<vector<int>> adj;
vector<int> nodes;
void dfs(int node,int p){
	nodes.pb(node);
	for(auto x: adj[node]){
		if(x==p)continue;
		dfs(x,node);
	}
}
int findEgg(int N, vector < pair < int, int > > bridges){
	adj=vector<vector<int>>(N+1,vector<int>());
	for(auto x: bridges){
		adj[x.first].pb(x.second);
		adj[x.second].pb(x.first);
	}
	dfs(1,0);
	int l=0;
	int r=N-1;
	while(l<r){
		int mid=(l+r+1)/2;
		if(query(vector<int>(nodes.begin(),nodes.begin()+mid))){
			r=mid-1;
		}
		else l=mid+1;
	}
	return nodes[l];
}
/*void compute(){
	
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
  //  freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
    int t;
    t=1;
  //  cin>>t;
    for(int i=1;i<=t;i++){
    //  cout<<"Case "<<i<<": "<<compute()<<'\n';
        compute();
    }
    return 0;
}*/
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 440 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 484 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 520 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -