# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
988604 | 2024-05-25T09:26:45 Z | Gray | Longest Trip (IOI23_longesttrip) | C++17 | 907 ms | 2108 KB |
#include "longesttrip.h" #include<bits/stdc++.h> #include <cassert> using namespace std; #define ll long long #define ff first #define ss second #define ln endl vector<vector<ll>> A; ll n, d; std::vector<int> longest_trip(int N, int D) { n=N; d=D; A.clear(); A.resize(N); for (ll i=0; i<n; i++){ for (ll j=i+1; j<n; j++){ if (are_connected({(int)i}, {(int)j})){ A[i].push_back(j); A[j].push_back(i); } } } vector<ll> semi; for (ll i=0; i<n; i++){ if (A[i].size()<n-1){ semi.push_back(i); } } assert(semi.size()>=0 and semi.size()<=2); vector<int> ans; if (semi.size()==1){ for (ll i=0; i<n; i++){ if (i!=semi[0]) ans.push_back(i); } }else if (semi.size()==0){ for (ll i=0; i<n; i++) ans.push_back(i); }else{ ans.push_back(semi[0]); for (ll i=0; i<n; i++){ if (i!=semi[0] and i!=semi[1]){ ans.push_back(i); } } ans.push_back(semi[1]); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 600 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Correct | 25 ms | 600 KB | Output is correct |
3 | Correct | 121 ms | 1120 KB | Output is correct |
4 | Correct | 366 ms | 1624 KB | Output is correct |
5 | Correct | 710 ms | 2108 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Correct | 22 ms | 344 KB | Output is correct |
3 | Correct | 111 ms | 1108 KB | Output is correct |
4 | Correct | 368 ms | 1112 KB | Output is correct |
5 | Correct | 760 ms | 1848 KB | Output is correct |
6 | Correct | 7 ms | 344 KB | Output is correct |
7 | Runtime error | 1 ms | 600 KB | Execution killed with signal 6 |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Correct | 22 ms | 344 KB | Output is correct |
3 | Correct | 122 ms | 1112 KB | Output is correct |
4 | Correct | 355 ms | 1132 KB | Output is correct |
5 | Correct | 907 ms | 1652 KB | Output is correct |
6 | Correct | 7 ms | 344 KB | Output is correct |
7 | Runtime error | 1 ms | 600 KB | Execution killed with signal 6 |
8 | Halted | 0 ms | 0 KB | - |
# | 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 | Partially correct | 144 ms | 700 KB | Output is partially correct |
4 | Partially correct | 370 ms | 1496 KB | Output is partially correct |
5 | Partially correct | 758 ms | 1972 KB | Output is partially correct |
6 | Correct | 7 ms | 344 KB | Output is correct |
7 | Runtime error | 1 ms | 596 KB | Execution killed with signal 6 |
8 | Halted | 0 ms | 0 KB | - |