답안 #854268

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
854268 2023-09-26T14:59:36 Z Ludissey 가장 긴 여행 (IOI23_longesttrip) C++17
5 / 100
6 ms 600 KB
#include <bits/stdc++.h>
#include "longesttrip.h"
using namespace std;

std::vector<int> longest_trip(int n, int d)
{
    vector<int> A;
    vector<int> B;
    A.push_back(0);
    for (int i = 1; i < n; i++)
    {
        if(are_connected({i}, {A[0]})) A.push_back(i);
        else if(B.size()==0 || are_connected({i}, {B[0]})) B.push_back(i);
        else {
            for (int x = B.size()-1; x >= 0; x--) A.insert(A.begin(), (B[x]));
            B.clear();
        }
    }
    if(A.size()<B.size()) swap(A,B);
    
    return A;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 356 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 5 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 5 ms 600 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 4 ms 596 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Incorrect 1 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 4 ms 596 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 5 ms 600 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -