Submission #971919

# Submission time Handle Problem Language Result Execution time Memory
971919 2024-04-29T13:45:51 Z kunzaZa183 Longest Trip (IOI23_longesttrip) C++17
15 / 100
6 ms 608 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> longest_trip(int N, int D)
{
  vector<int> vi(N - 1);
  iota(vi.begin(), vi.end(), 1);
  vector<int> trip(1, 0);
  while (vi.size() >= 2)
    if (are_connected(vector<int>(1, trip.back()), vector<int>(1, vi.front())))
    {
      trip.push_back(vi.front());
      vi.erase(vi.begin());
    }
    else
    {
      trip.push_back(vi[1]);
      trip.push_back(vi[0]);
      vi.erase(vi.begin());
      vi.erase(vi.begin());
    }
  if (vi.size() == 1)
  {
    if (are_connected(vector<int>(1, trip.back()), vector<int>(1, vi.front())))
    {
      trip.push_back(vi.front());
      vi.erase(vi.begin());
    }
    else
    {
      trip.push_back(trip.front());
      trip.push_back(vi.front());
      vi.erase(vi.begin());
      trip.erase(trip.begin());
    }
  }
  return trip;
}
# 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 6 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 5 ms 600 KB Output is correct
10 Correct 4 ms 600 KB Output is correct
11 Correct 4 ms 344 KB Output is correct
12 Correct 5 ms 608 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 4 ms 352 KB Output is correct
9 Correct 5 ms 344 KB Output is correct
10 Correct 4 ms 596 KB Output is correct
11 Correct 4 ms 344 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 5 ms 356 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 5 ms 344 KB Output is correct
11 Correct 4 ms 344 KB Output is correct
12 Correct 5 ms 344 KB Output is correct
13 Correct 6 ms 344 KB Output is correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -