Submission #980030

# Submission time Handle Problem Language Result Execution time Memory
980030 2024-05-11T19:29:19 Z vjudge1 Longest Trip (IOI23_longesttrip) C++17
0 / 100
1 ms 344 KB
// hola soy Dember :D
// 31/03/2024
#include "longesttrip.h"
#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;
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB invalid array
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB invalid array
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB invalid array
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB invalid array
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB invalid array
2 Halted 0 ms 0 KB -