답안 #319510

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
319510 2020-11-05T12:57:49 Z tasfiq4 Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
381 ms 131076 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
typedef pair<int,int > pii;
typedef long long int lld;
#define pi acos(-1)
#define fr(i,m,n) for(i=m;i<n;i++)
#define fu(i,m,n) for(i=m;i>=n;i--)
#define vec vector<int>
#define pb push_back
#define pp pop_back()
#define ft first
#define sd second
#define all(v) v.begin(),v.end()
#define mom(ara) memset(ara,0,sizeof(ara));
#define m1m(ara) memset(ara,-1,sizeof(ara));
#define endl "\n"
#define eps 1.19209e-07
vec adj[600];
vec eul;
void dfs(int u,int p)
{
	for(auto v:adj[u])
	{
		if(v==p) continue;
		eul.pb(v);
		dfs(v,u);
	}
}
bool que(int m)
{
	vec h;
	int i;
	fr(i,0,m)
	{
		h.pb(eul[i]);
	}
	return query(h);
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
    int i,j,k,a,b,c,x,y,z,n,m,ans,t;
    n=N;
    fr(i,1,n)
    {
    	x=bridges[i-1].ft;y=bridges[i-1].sd;
    	adj[x].pb(y);
    	adj[y].pb(x);
    }
    eul.pb(1);
    dfs(1,0);
    int l=0,r=n,mid;
    while(l+1<r)
    {
    	mid=(l+r)/2;
    	if(que(mid))
    	{
    		r=mid;
    	}
    	else l=mid;
    }
    return eul[r-1];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:42:11: warning: unused variable 'j' [-Wunused-variable]
   42 |     int i,j,k,a,b,c,x,y,z,n,m,ans,t;
      |           ^
eastereggs.cpp:42:13: warning: unused variable 'k' [-Wunused-variable]
   42 |     int i,j,k,a,b,c,x,y,z,n,m,ans,t;
      |             ^
eastereggs.cpp:42:15: warning: unused variable 'a' [-Wunused-variable]
   42 |     int i,j,k,a,b,c,x,y,z,n,m,ans,t;
      |               ^
eastereggs.cpp:42:17: warning: unused variable 'b' [-Wunused-variable]
   42 |     int i,j,k,a,b,c,x,y,z,n,m,ans,t;
      |                 ^
eastereggs.cpp:42:19: warning: unused variable 'c' [-Wunused-variable]
   42 |     int i,j,k,a,b,c,x,y,z,n,m,ans,t;
      |                   ^
eastereggs.cpp:42:25: warning: unused variable 'z' [-Wunused-variable]
   42 |     int i,j,k,a,b,c,x,y,z,n,m,ans,t;
      |                         ^
eastereggs.cpp:42:29: warning: unused variable 'm' [-Wunused-variable]
   42 |     int i,j,k,a,b,c,x,y,z,n,m,ans,t;
      |                             ^
eastereggs.cpp:42:31: warning: unused variable 'ans' [-Wunused-variable]
   42 |     int i,j,k,a,b,c,x,y,z,n,m,ans,t;
      |                               ^~~
eastereggs.cpp:42:35: warning: unused variable 't' [-Wunused-variable]
   42 |     int i,j,k,a,b,c,x,y,z,n,m,ans,t;
      |                                   ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 381 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 286 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 289 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -