답안 #851601

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
851601 2023-09-20T08:37:05 Z eltu0815 가장 긴 여행 (IOI23_longesttrip) C++17
15 / 100
827 ms 592 KB
#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

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 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 504 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 30 ms 344 KB Output is correct
3 Correct 127 ms 344 KB Output is correct
4 Correct 375 ms 344 KB Output is correct
5 Correct 827 ms 412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 22 ms 344 KB Output is correct
3 Correct 123 ms 344 KB Output is correct
4 Correct 344 ms 344 KB Output is correct
5 Correct 738 ms 412 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 25 ms 344 KB Output is correct
8 Correct 135 ms 344 KB Output is correct
9 Correct 260 ms 592 KB Output is correct
10 Correct 771 ms 412 KB Output is correct
11 Correct 756 ms 416 KB Output is correct
12 Correct 791 ms 432 KB Output is correct
13 Correct 751 ms 412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 31 ms 344 KB Output is correct
3 Correct 127 ms 344 KB Output is correct
4 Correct 373 ms 344 KB Output is correct
5 Correct 768 ms 416 KB Output is correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 26 ms 344 KB Output is correct
8 Correct 129 ms 344 KB Output is correct
9 Correct 265 ms 424 KB Output is correct
10 Correct 763 ms 416 KB Output is correct
11 Correct 757 ms 412 KB Output is correct
12 Correct 762 ms 416 KB Output is correct
13 Correct 776 ms 408 KB Output is correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 22 ms 344 KB Output is correct
3 Partially correct 133 ms 344 KB Output is partially correct
4 Partially correct 402 ms 344 KB Output is partially correct
5 Partially correct 761 ms 412 KB Output is partially correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 25 ms 344 KB Output is correct
8 Partially correct 128 ms 344 KB Output is partially correct
9 Partially correct 293 ms 416 KB Output is partially correct
10 Partially correct 747 ms 412 KB Output is partially correct
11 Partially correct 787 ms 592 KB Output is partially correct
12 Partially correct 803 ms 412 KB Output is partially correct
13 Partially correct 769 ms 412 KB Output is partially correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -