Submission #856984

# Submission time Handle Problem Language Result Execution time Memory
856984 2023-10-05T04:22:59 Z IS_Rushdi Longest Trip (IOI23_longesttrip) C++17
5 / 100
5 ms 444 KB
#include<bits/stdc++.h>
using namespace std;
#include "longesttrip.h"

// bool are_connected(vector<int>a,vector<int>b){
//     return 0;
// }
vector<int> longest_trip(int n, int k)
{
    vector<int>ans;
    if(k == 3) for(int i = 0; i < n; i++) ans.push_back(i);
    else if(k == 2){
        int v = 0;  ans.push_back(0);
        set<int>st;
        for(int i = 1; i < n; i++) st.insert(i);

        for(int i = 1; i < n; i++){
            vector<int>one;one.push_back(v);
            for(int u : st){
                vector<int>two; two.push_back(u);
                bool ok = are_connected(one,two);
                if(ok){
                    v = u;
                    break;
                }
            }
            ans.push_back(v);
            st.erase(v);
        }
    }

    return ans;
}
// int main(){

// }

# 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 2 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory 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 444 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 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 -