Submission #1000960

# Submission time Handle Problem Language Result Execution time Memory
1000960 2024-06-18T11:58:21 Z 변재우(#10901) Longest Trip (IOI23_longesttrip) C++17
0 / 100
38 ms 468 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) {
        sort(V.begin(), V.end(), [](vector<int> a, vector<int> b){return a.size()>b.size();});
        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();
        }
    }
    sort(V.begin(), V.end(), [](vector<int> a, vector<int> b){return a.size()>b.size();});
    return V[0];
}
# 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 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 Correct 4 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 12 ms 344 KB Output is correct
5 Correct 34 ms 460 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 7 ms 344 KB Output is correct
9 Correct 11 ms 344 KB Output is correct
10 Correct 23 ms 456 KB Output is correct
11 Correct 38 ms 468 KB Output is correct
12 Correct 28 ms 460 KB Output is correct
13 Correct 24 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 -