# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
915993 | 2024-01-25T05:39:52 Z | chirathnirodha | Longest Trip (IOI23_longesttrip) | C++17 | 1000 ms | 1840 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){ if(D==3){ vector<int> tt;for(int i=0;i<n;i++)tt.PB(i); return tt; } 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 | 1 ms | 344 KB | Output is correct |
2 | Execution timed out | 3068 ms | 1840 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Execution timed out | 3051 ms | 344 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Execution timed out | 3063 ms | 344 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Execution timed out | 3053 ms | 344 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |