답안 #900522

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
900522 2024-01-08T12:25:46 Z abcvuitunggio 가장 긴 여행 (IOI23_longesttrip) C++17
15 / 100
6 ms 608 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> longest_trip(int N, int D){
    if (D>1){
        deque <int> q={0};
        if (!are_connected({0},{1}))
            q.push_back(2);
        q.push_back(1);
        for (int i=q.size();i<N;i++)
            if (are_connected({i},{q.front()}))
                q.push_front(i);
            else
                q.push_back(i);
        vector <int> res;
        for (int i:q)
            res.push_back(i);
        return res;
    }
    vector <int> a,b;
    a.push_back(0);
    b.push_back(1);
    for (int i=2;i<N;i++){
        if (are_connected({a.back()},{i})){
            a.push_back(i);
            continue;
        }
        if (are_connected({b.back()},{i})){
            b.push_back(i);
            continue;
        }
        reverse(b.begin(),b.end());
        for (int i:b)
            a.push_back(i);
        b={i};
    }
    if (are_connected({a[0]},{b[0]}))
        reverse(a.begin(),a.end());
    for (int i:b)
        a.push_back(i);
    return a;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 516 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 5 ms 604 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 4 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 4 ms 344 KB Output is correct
11 Correct 4 ms 344 KB Output is correct
12 Correct 5 ms 600 KB Output is correct
13 Correct 5 ms 608 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 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 5 ms 344 KB Output is correct
11 Correct 5 ms 344 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Incorrect 1 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 4 ms 348 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 6 ms 348 KB Output is correct
7 Correct 6 ms 500 KB Output is correct
8 Correct 5 ms 348 KB Output is correct
9 Correct 5 ms 348 KB Output is correct
10 Correct 5 ms 348 KB Output is correct
11 Correct 4 ms 348 KB Output is correct
12 Correct 5 ms 344 KB Output is correct
13 Correct 5 ms 604 KB Output is correct
14 Incorrect 0 ms 348 KB Incorrect
15 Halted 0 ms 0 KB -