Submission #1069584

# Submission time Handle Problem Language Result Execution time Memory
1069584 2024-08-22T06:24:30 Z Sir_Ahmed_Imran Longest Trip (IOI23_longesttrip) C++17
Compilation error
0 ms 0 KB
                            ///~~~LOTA~~~///
#include "longesttrip"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define terminator main
#define N 256
int nxt[N];
vector<int> solve1(int n){
    int a,b,p,q,x,y,z;
    a=b=0;p=q=1;
    x=y=1;
    for(int i=2;i<=n;i++){
        if(are_connected({b},{i})){
            nxt[b]=i;
            x++;
            b=i;
        }
        else if(are_connected({i},{p})){
            nxt[i]=p;
            y++;
            p=i;
        }
        else{
            nxt[b]=p;
            x+=y;
            b=q;
            y=1;
            p=q=i;
        }
    }
    if(x>y) z=a;
    else z=p;
    vector<int> v;
    for(int i=0;i<max(x,y);i++){
        v.append(z);
        z=nxt[z];
    }
    return v;
}
vector<int> solve2(int n){
    int p,q,r;
    p=0;
    q=1;
    r=are_connected({0},{1});
    for(int i=3-r;i<n;i++){
        if(are_connected(q,i)){
            nxt[q]=i;
            q=i;
        }
        else{
            nxt[i]=p;
            p=i;
        }
    }
    vector<int> v;
    for(int i=0;i<n;i++){
        v.append(p);
        p=nxt[p];
    }
    return v;
}
vector<int> solve3(int n){
    vector<int> v;
    for(int i=0;i<n;i++)
        v.append(i);
    return v;
}
vector<int> longest_trip(int n,int d){
    if(d==3) return solve3(n);
    if(d==2) return solve2(n);
    return solve1(n);
}

Compilation message

longesttrip.cpp:2:10: fatal error: longesttrip: No such file or directory
    2 | #include "longesttrip"
      |          ^~~~~~~~~~~~~
compilation terminated.