Submission #980029

# Submission time Handle Problem Language Result Execution time Memory
980029 2024-05-11T19:28:40 Z vjudge1 Longest Trip (IOI23_longesttrip) C++17
Compilation error
0 ms 0 KB
// 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;

ll n, k, xd, zd;

vector<ll> a,b, ans, vac;
pair<vector<ll>, vector<ll>> c1, c2;

vector<int> longest_trip(int N, int D){
    n=N; k=D;a.pb(0);
	
	fo(i,1,n){
	    c1.F=c1.S=c2.F=c1.F=vac;
		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: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:34:7: error: 'are_connected' was not declared in this scope
   34 |    if(are_connected(c2.F,c2.S))
      |       ^~~~~~~~~~~~~
longesttrip.cpp:41:6: error: 'are_connected' was not declared in this scope
   41 |   if(are_connected(c1.F,c1.S))a.pb(i);
      |      ^~~~~~~~~~~~~