# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
856912 | 2023-10-04T19:59:57 Z | IS_Rushdi | Longest Trip (IOI23_longesttrip) | C++17 | 40 ms | 1208 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); if(k == 2){ int v = 0; ans.push_back(0); vector<int>a; for(int i = 1; i < n; i++) a.push_back(i); for(int i = 1; i < n; i++){ vector<int>wow; wow.push_back(v); vector<int>arr = a; while(arr.size() > 1){ int m = arr.size()/2; vector<int>newarr; for(int j = 0; j < m; j++) newarr.push_back(arr[j]); bool ok = are_connected(wow,newarr); if(ok){ arr = newarr; }else{ vector<int>newarr2; for(int j = m; j < arr.size(); j++) newarr2.push_back(arr[j]); arr = newarr2; } } vector<int>A; for(int i = 0; i < a.size(); i++){ if(a[i] == arr[0]) continue; A.push_back(a[i]); } a = A; v = arr[0]; ans.push_back(v); } } return ans; } // int main(){ // }
Compilation message
# | 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 | 500 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 | 8 ms | 344 KB | Output is correct |
3 | Correct | 19 ms | 344 KB | Output is correct |
4 | Correct | 26 ms | 444 KB | Output is correct |
5 | Correct | 40 ms | 1208 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 | 1 ms | 344 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |