# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1000959 |
2024-06-18T11:57:15 Z |
변재우(#10901) |
Longest Trip (IOI23_longesttrip) |
C++17 |
|
34 ms |
448 KB |
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> longest_trip(int N, int D)
{
vector<vector<int>> V(N);
for(int i=0; i<N; i++) V[i].push_back(i);
while(V.size()>2) {
sort(V.begin(), V.end(), [](vector<int> a, vector<int> b){return a.size()>b.size();});
if(are_connected({V[0][0]}, {V[1][0]})) {
reverse(V[1].begin(), V[1].end());
for(int i:V[1]) V[0].push_back(i);
swap(V[1], V.back()); V.pop_back();
}
else if(are_connected({V[0][0]}, {V[2][0]})) {
reverse(V[2].begin(), V[2].end());
for(int i:V[2]) V[0].push_back(i);
swap(V[2], V.back()); V.pop_back();
}
else {
reverse(V[1].begin(), V[1].end());
for(int i:V[1]) V[0].push_back(i);
swap(V[1], V.back()); V.pop_back();
}
}
sort(V.begin(), V.end(), [](vector<int> a, vector<int> b){return a.size()>b.size();});
return V[0];
}
# |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
7 ms |
344 KB |
Output is correct |
3 |
Correct |
7 ms |
344 KB |
Output is correct |
4 |
Correct |
13 ms |
448 KB |
Output is correct |
5 |
Correct |
34 ms |
344 KB |
Output is correct |
6 |
Correct |
4 ms |
344 KB |
Output is correct |
7 |
Incorrect |
0 ms |
344 KB |
Incorrect |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |