# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
918019 | 2024-01-29T12:12:53 Z | Elwino008 | Easter Eggs (info1cup17_eastereggs) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define pii pair<int, int> #define pb push_back #define F first #define S second #define ll long long #define int ll #define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define M_PI 3.14159265358979323846 #define all(v) v.begin(), v.end() #define pss pair<string, string> #define no cout<<"NO"<<endl; #define yes cout<<"YES"<<endl; #define imp cout<<-1<<endl; #define flu cout.flush(); const int N = 100009; const int mod = 1e9+7; int n, used[555]; vector<int>a[555]; vector<int>nodes; void dfs(int node){ used[node]=1; nodes.pb(node); for(int i : a[node]){ if(used[i]==0){ dfs(i); } } } signed main(){ io; cin>>n; for(int i=0; i<n-1; i++){ int x, y; cin>>x>>y; a[x].pb(y); a[y].pb(x); } dfs(1); int l=1, r=n; while(l<=r){ int mid=(l+r)/2; vector<int>v; for(int i=l; i<=mid; i++){ v.pb(i); } cout<<v.size()<<" "; for(int i : v){ cout<<i<<" "; } cout<<endl; flu; int ans; cin>>ans; if(ans==1){ r=mid-1; } else{ l=mid+1; } } cout<<r+1<<endl; flu; }