Submission #851602

# Submission time Handle Problem Language Result Execution time Memory
851602 2023-09-20T08:44:44 Z eltu0815 Longest Trip (IOI23_longesttrip) C++17
15 / 100
844 ms 592 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> longest_trip(int N, int D)
{
    if(D >= 1) {
        vector<pair<int, int> > idp;
        for(int i = 0; i < N; ++i) for(int j = i + 1; j < N; ++j) {
            vector<int> a, b;
            a.push_back(i); b.push_back(j);
            if(!are_connected(a, b)) idp.push_back({i, j});
        }
        
        vector<int> chk(N, 0);
        for(auto p : idp) chk[p.first] = chk[p.second] = 1;
        
        vector<int> ret;
        for(int i = 0; i < (int)idp.size(); ++i) ret.push_back(idp[i].first);
        for(int i = 0; i < N; ++i) if(!chk[i]) ret.push_back(i);
        for(int i = 0; i < (int)idp.size(); ++i) ret.push_back(idp[i].second);
        return ret;
    }
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
# 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 8 ms 344 KB Output is correct
2 Correct 28 ms 344 KB Output is correct
3 Correct 141 ms 344 KB Output is correct
4 Correct 404 ms 344 KB Output is correct
5 Correct 760 ms 412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 23 ms 344 KB Output is correct
3 Correct 128 ms 344 KB Output is correct
4 Correct 385 ms 344 KB Output is correct
5 Correct 787 ms 416 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 29 ms 344 KB Output is correct
8 Correct 137 ms 344 KB Output is correct
9 Correct 267 ms 592 KB Output is correct
10 Correct 754 ms 408 KB Output is correct
11 Correct 779 ms 416 KB Output is correct
12 Correct 808 ms 412 KB Output is correct
13 Correct 781 ms 412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 26 ms 344 KB Output is correct
3 Correct 147 ms 344 KB Output is correct
4 Correct 363 ms 344 KB Output is correct
5 Correct 844 ms 412 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 30 ms 344 KB Output is correct
8 Correct 108 ms 344 KB Output is correct
9 Correct 288 ms 344 KB Output is correct
10 Correct 753 ms 408 KB Output is correct
11 Correct 782 ms 416 KB Output is correct
12 Correct 749 ms 416 KB Output is correct
13 Correct 764 ms 412 KB Output is correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 344 KB Output is correct
2 Correct 23 ms 344 KB Output is correct
3 Partially correct 144 ms 344 KB Output is partially correct
4 Partially correct 388 ms 344 KB Output is partially correct
5 Partially correct 737 ms 412 KB Output is partially correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 24 ms 344 KB Output is correct
8 Partially correct 130 ms 344 KB Output is partially correct
9 Partially correct 263 ms 408 KB Output is partially correct
10 Partially correct 777 ms 500 KB Output is partially correct
11 Partially correct 784 ms 408 KB Output is partially correct
12 Partially correct 770 ms 412 KB Output is partially correct
13 Partially correct 758 ms 412 KB Output is partially correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -