Submission #855156

# Submission time Handle Problem Language Result Execution time Memory
855156 2023-09-30T10:38:23 Z evenvalue Longest Trip (IOI23_longesttrip) C++17
0 / 100
1 ms 344 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;

template<typename T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using max_heap = priority_queue<T, vector<T>, less<T>>;

using int64 = long long;
using ld = long double;

constexpr int kInf = 1e9 + 10;
constexpr int64 kInf64 = 1e15 + 10;
constexpr int kMod = 1e9 + 7;

std::vector<int> longest_trip(int N, int D) {
  deque<int> longest_path;
  
  for (int i = 0; i < 3; i++) {
    const int j = (i + 1) % 3;
    if (not are_connected({i}, {j})) {
      longest_path = {i, (i + 2) % 3, j};
    }
  }
  
  for (int x = 3; x < N; x++) {
    const int y = longest_path.back();
    if (are_connected({x}, {y})) {
      longest_path.push_back(x);
    } else {
      longest_path.push_front(x);
    }
  }
  
  vector<int> ans;
  for (const int x : longest_path) {
    ans.push_back(x);
  }
  
  return ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 11
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 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 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -