# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
856911 | 2023-10-04T19:54:09 Z | IS_Rushdi | Longest Trip (IOI23_longesttrip) | C++17 | 42 ms | 1476 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<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 | Correct | 2 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 600 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 504 KB | Output is correct |
2 | Correct | 8 ms | 344 KB | Output is correct |
3 | Correct | 19 ms | 608 KB | Output is correct |
4 | Correct | 29 ms | 440 KB | Output is correct |
5 | Correct | 42 ms | 1476 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 | - |