Submission #856898

# Submission time Handle Problem Language Result Execution time Memory
856898 2023-10-04T19:30:49 Z IS_Rushdi Longest Trip (IOI23_longesttrip) C++17
5 / 100
6 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
#include "longesttrip.h"

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);
        vector<bool>vis(n,0); vis[0] = 1;
        for(int i = 1; i < n; i++){
            for(int j = 0; j < n; j++){
                if(vis[j]) continue; 
                vector<int>tmp;tmp.push_back(v);
                vector<int>tmp2;tmp2.push_back(j);
                bool ok = are_connected(tmp,tmp2);
                if(ok){v = j;ans.push_back(j);vis[j]=1;}
            }
        }
        
    }

    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 0 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 4 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Incorrect 1 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 1 ms 348 KB Incorrect
2 Halted 0 ms 0 KB -