답안 #978517

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
978517 2024-05-09T09:26:26 Z mariza 가장 긴 여행 (IOI23_longesttrip) C++17
5 / 100
6 ms 608 KB
#include "longesttrip.h"

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

std::vector<int> longest_trip(int N, int D)
{
    vector<int> a, 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.empty() || are_connected({i},{b.back()})) {
            b.push_back(i);
        }
        else {
            for(ll j=b.size()-1; j>=0; j--) {
                a.push_back(b[i]);
            }
            b.clear();
        }
    }

    if(a.size()>b.size()) return a;
    else return b;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 2 ms 608 KB Incorrect
3 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 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 4 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 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 4 ms 600 KB Output is correct
6 Incorrect 1 ms 500 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 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 4 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 4 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 4 ms 600 KB Output is correct
14 Correct 6 ms 344 KB Output is correct
15 Incorrect 4 ms 596 KB Incorrect
16 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 5 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 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -