# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
915991 | 2024-01-25T05:38:13 Z | chirathnirodha | Longest Trip (IOI23_longesttrip) | C++17 | 1000 ms | 1732 KB |
#include "longesttrip.h" #include<bits/stdc++.h> using namespace std; #define PB push_back #define MP make_pair #define P push #define I insert #define F first #define S second typedef long long ll; vector<int> v[256]; int ans; vector<int> t,curv; bool visited[256]; void dfs(int x,int cur){ curv.PB(x); visited[x]=true; if(ans<cur){ t=curv; ans=cur; } for(int i=0;i<v[x].size();i++){ int y=v[x][i]; if(visited[y])continue; dfs(y,cur+1); } visited[x]=false; curv.pop_back(); } vector<int> longest_trip(int n, int D){ memset(visited,false,sizeof(visited)); for(int i=0;i<n;i++)v[i].clear(); ans=0; for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ if(are_connected({i},{j})){v[i].PB(j);v[j].PB(i);} } } for(int i=0;i<n;i++){ dfs(i,1); } return t; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Execution timed out | 3020 ms | 1732 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 344 KB | Output is correct |
2 | Execution timed out | 3055 ms | 344 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Execution timed out | 3049 ms | 344 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Execution timed out | 3056 ms | 596 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 596 KB | Output is correct |
2 | Execution timed out | 3022 ms | 344 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |