// hola soy Dember :D
// 31/03/2024
#include <bits/stdc++.h>
#define ll int
#define pll pair<ll,ll>
#define F first
#define S second
#define Z size()
#define pb push_back
#define bp pop_back
#define fo(x,y,z) for(ll x=y; x<=z; x++)
#define of(x,y,z) for(ll x=y; x>=z; x--)
#define all(n) n.begin(), n.end()
#define arr(x,y,z) x+y, x+y+z
using namespace std;
void value(ll in){cout<<((in)?"YES\n":"NO\n");}
const ll N=2e5+5, M=3e3+5, mod=998244353, md=1e9+7, inf=1e18;
ll n, k, xd, zd;
vector<ll> a(1,0),b, ans;
pair<vector<ll>, vector<ll>> c1, c2;
/*bool are_connected(vector<ll> x, vector<ll> y){
cout<<"a "; for(auto u:x)cout<<u<<' '; cout<<"\n";
cout<<"b "; for(auto u:y)cout<<u<<' '; cout<<"\n";
bool sp;
cin>>sp;
return sp;
}*/
vector<int> longest_trip(int N, int D){
n=N; k=D;
fo(i,1,n){
while(!b.empty()){
c2.F.pb(a.back());
c2.S.pb(b.back());
if(are_connected(c2.F,c2.S))
while(!b.empty()){a.pb(b.back());b.bp();}
}
c1.F.pb(a.back());
c1.S.pb(i);
if(are_connected(c1.F,c1.S))a.pb(i);
else b.pb(i);
}
ans=((a.size()>b.size())?a:b);
return ans;
}
/*int main()
{
cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int t=1, m;
cin>>t>>m;
vector<ll> v=longest_trip(t,m);
for(auto u:v)cout<<u<<' ';cout<<"\n"
return 0;
}*/
Compilation message
longesttrip.cpp:22:57: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
22 | const ll N=2e5+5, M=3e3+5, mod=998244353, md=1e9+7, inf=1e18;
| ^~~~
longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:45:7: error: 'are_connected' was not declared in this scope
45 | if(are_connected(c2.F,c2.S))
| ^~~~~~~~~~~~~
longesttrip.cpp:52:6: error: 'are_connected' was not declared in this scope
52 | if(are_connected(c1.F,c1.S))a.pb(i);
| ^~~~~~~~~~~~~