Submission #851601

#TimeUsernameProblemLanguageResultExecution timeMemory
851601eltu0815가장 긴 여행 (IOI23_longesttrip)C++17
15 / 100
827 ms592 KiB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> longest_trip(int N, int D)
{
    if(D >= 2) {
        vector<pair<int, int> > idp;
        for(int i = 0; i < N; ++i) for(int j = i + 1; j < N; ++j) {
            vector<int> a, b;
            a.push_back(i); b.push_back(j);
            if(!are_connected(a, b)) idp.push_back({i, j});
        }
        
        vector<int> chk(N, 0);
        for(auto p : idp) chk[p.first] = chk[p.second] = 1;
        
        vector<int> ret;
        for(int i = 0; i < (int)idp.size(); ++i) ret.push_back(idp[i].first);
        for(int i = 0; i < N; ++i) if(!chk[i]) ret.push_back(i);
        for(int i = 0; i < (int)idp.size(); ++i) ret.push_back(idp[i].second);
        return ret;
    }
}

Compilation message (stderr)

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...