Submission #839808

# Submission time Handle Problem Language Result Execution time Memory
839808 2023-08-30T16:57:46 Z AdamGS Longest Trip (IOI23_longesttrip) C++17
0 / 100
1 ms 388 KB
#include "longesttrip.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
vector<int>longest_trip(int n, int d) {
  vector<int>A, B;
  A.pb(0);
  for(int i=1; i<n; ++i) {
    vector<int>X, Y;
    X.pb(A.back());
    Y.pb(i);
    if(are_connected(X, Y)) A.pb(i);
    else B.pb(i);
    X.clear();
    Y.clear();
    X.pb(A.back());
    Y.pb(B.back());
    if(are_connected(X, Y)) while(B.size()>0) {
      A.pb(B.back());
      B.pop_back();
    }
  }
  if(B.size()>A.size()) swap(A, B);
  return A;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 388 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -