답안 #854269

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
854269 2023-09-26T15:02:02 Z Ludissey 가장 긴 여행 (IOI23_longesttrip) C++17
5 / 100
1000 ms 756 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.back()})) A.push_back(i);
        else if(B.size()==0 || are_connected({i}, {B.back()})) B.push_back(i);
        else {
            for (int x = B.size()-1; x >= 0; x--) A.push_back(B[x]);
            B.clear();
        }
    }
    if(A.size()<B.size()) swap(A,B);
    if(!are_connected({A[0]}, {A.back()})) while(true) { }; 
    return A;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3033 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 344 KB Output is correct
2 Correct 6 ms 756 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 7 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 4 ms 344 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 5 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 Execution timed out 3020 ms 344 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 6 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 4 ms 344 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -