Submission #1000965

# Submission time Handle Problem Language Result Execution time Memory
1000965 2024-06-18T12:00:53 Z 변재우(#10901) Longest Trip (IOI23_longesttrip) C++17
0 / 100
7 ms 344 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> longest_trip(int N, int D)
{
    vector<vector<int>> V(N);
    for(int i=0; i<N; i++) V[i].push_back(i);
    while(V.size()>2) {
        if(are_connected({V[0][0]}, {V[1][0]})) {
            reverse(V[0].begin(), V[0].end());
            for(int i:V[1]) V[0].push_back(i);
            swap(V[1], V.back()); V.pop_back();
        }
        else if(are_connected({V[0][0]}, {V[2][0]})) {
            reverse(V[0].begin(), V[0].end());
            for(int i:V[2]) V[0].push_back(i);
            swap(V[2], V.back()); V.pop_back();
        }
        else {
            reverse(V[0].begin(), V[0].end());
            for(int i:V[1]) V[0].push_back(i);
            swap(V[1], V.back()); V.pop_back();
        }
    }
    if(V[1].size()>V[0].size()) return V[1];
    return V[0];
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 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 6 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 4 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 3 ms 344 KB Output is correct
10 Correct 5 ms 344 KB Output is correct
11 Correct 6 ms 344 KB Output is correct
12 Correct 7 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -