답안 #851600

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
851600 2023-09-20T08:31:55 Z eltu0815 가장 긴 여행 (IOI23_longesttrip) C++17
5 / 100
760 ms 416 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> longest_trip(int N, int D)
{
    if(D == 1) {
        vector<int> ret;
        for(int i = 0; i < N; ++i) ret.push_back(i);
        return ret;
    }
    else {
        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 < (int)idp.size(); ++i) ret.push_back(idp[i].second);
        for(int i = 0; i < N; ++i) if(!chk[i]) ret.push_back(i);
        return ret;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 25 ms 344 KB Output is correct
3 Correct 128 ms 344 KB Output is correct
4 Correct 341 ms 344 KB Output is correct
5 Correct 751 ms 416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 24 ms 344 KB Output is correct
3 Correct 120 ms 344 KB Output is correct
4 Correct 407 ms 344 KB Output is correct
5 Correct 760 ms 408 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Incorrect 1 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -