Submission #1006946

# Submission time Handle Problem Language Result Execution time Memory
1006946 2024-06-24T10:10:40 Z De3b0o Longest Trip (IOI23_longesttrip) C++17
0 / 100
1 ms 344 KB
#include "longesttrip.h"
#include<bits/stdc++.h>
#include<random>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*n)
#define rc (2*n+1)

using namespace std;

std::vector<int> longest_trip(int N, int D)
{
    ll x;
    ll n = N;
    for(int i = 1 ; n>i ; i++)
    {
        if(are_connected({0},{i})==0)
            x=i;
    }
    vector<int> trnbo;
    trnbo.pb(0);
    for(int i = 1 ; n>i ; i++)
    {
        if(i==x)
            continue;
        trnbo.pb(i);
    }
    trnbo.pb(x);
    return trnbo;
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:41:13: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   41 |     trnbo.pb(x);
      |     ~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -