#include "longesttrip.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>longest_trip_1(int N){
vector<int>ans;
for(int i=0;i<N;i++)ans.push_back(i);
return ans;
}
vector<int>longest_trip_2(int N){
vector<int>ans;
vector<int>tans;
tans.push_back(0);
for(int i=1;i<N;i++){
if(are_connected({i-1},{i}))tans.push_back(i);
else if(i!=N)tans.push_back(i+1),tans.push_back(i),i++;
else ans.push_back(i);
}
for(auto x:tans)ans.push_back(x);
return ans;
}
vector<int>longest_trip_3(int N){
vector<int>ans;
for(int i=0;i<N;i++)ans.push_back(i);
return ans;
}
vector<int> longest_trip(int N, int D)
{
if(D==1)return longest_trip_1(N);
else if(D==2)return longest_trip_2(N);
else return longest_trip_3(N);
return {};
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
428 KB |
Output is correct |
5 |
Correct |
1 ms |
432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
344 KB |
Output is correct |
2 |
Correct |
5 ms |
344 KB |
Output is correct |
3 |
Correct |
6 ms |
500 KB |
Output is correct |
4 |
Correct |
5 ms |
344 KB |
Output is correct |
5 |
Correct |
5 ms |
344 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 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 |
600 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Incorrect |
1 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
340 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 |
6 |
Incorrect |
0 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |