답안 #839733

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
839733 2023-08-30T15:49:19 Z model_code 가장 긴 여행 (IOI23_longesttrip) C++17
5 / 100
12 ms 352 KB
// incorrect/solution-wa-lineSearch.cpp

#include "longesttrip.h"
#include <algorithm>
#include <random>
#include <set>

std::vector<int> longest_trip(int N, int /*D*/)
{
    std::set<int> nodes;
    nodes.clear();
    std::vector<int> ans;
    ans.clear();
    for (int i = 1; i < N; i++)
        nodes.insert(i);
    int last = 0;
    ans.push_back(0);

    while (!nodes.empty())
    {
        bool found = false;
        for (int i : nodes)
        {
            if (are_connected({last}, {i}))
            {
                last = i;
                nodes.erase(i);
                ans.push_back(last);
                found = true;
                break;
            }
        }
        if (!found)
            break;
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 3 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 208 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Correct 5 ms 208 KB Output is correct
4 Correct 7 ms 208 KB Output is correct
5 Correct 9 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 9 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 7 ms 208 KB Output is correct
5 Correct 9 ms 280 KB Output is correct
6 Incorrect 0 ms 208 KB Incorrect
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 208 KB Output is correct
2 Correct 9 ms 208 KB Output is correct
3 Correct 11 ms 208 KB Output is correct
4 Correct 8 ms 208 KB Output is correct
5 Correct 7 ms 208 KB Output is correct
6 Correct 9 ms 208 KB Output is correct
7 Correct 9 ms 208 KB Output is correct
8 Correct 7 ms 208 KB Output is correct
9 Correct 9 ms 208 KB Output is correct
10 Correct 7 ms 300 KB Output is correct
11 Correct 10 ms 300 KB Output is correct
12 Correct 10 ms 296 KB Output is correct
13 Correct 7 ms 300 KB Output is correct
14 Correct 9 ms 208 KB Output is correct
15 Incorrect 1 ms 208 KB Incorrect
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 208 KB Output is correct
2 Correct 9 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 10 ms 208 KB Output is correct
5 Correct 9 ms 352 KB Output is correct
6 Incorrect 0 ms 208 KB Incorrect
7 Halted 0 ms 0 KB -