Submission #1056263

#TimeUsernameProblemLanguageResultExecution timeMemory
1056263jcelin가장 긴 여행 (IOI23_longesttrip)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> ii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<ll> vll; typedef vector<pll> vpll; #define PB push_back #define PF push_front #define PPB pop_back #define PPF pop_front #define X first #define Y second #define MP make_pair #define all(x) (x).begin(), (x).end() const int mod = 1e9 + 7; //998244353; const int inf = 1e9 + 7; const ll INF = 1e18 + 7; const int logo = 20; const int MAXN = 1e6 + 7; const int off = 1 << logo; const int trsz = off << 1; const int dx[] = {1, -1, 0, 0}; const int dy[] = {0, 0, -1, 1}; void nadi(vi &a, vi b){ int lo = 0, hi = (int)a.size() - 1, ret = -1; while(lo <= hi){ int mid = (lo + hi) / 2; vi vec; for(int i=0; i<=mid; i++) vec.PB(i); if(are_connected(a, b)) ret = mid, hi = mid - 1; else lo = mid + 1; } int vl = a[ret]; while(a.back() != vl){ int x = a.back(); a.PPB(); reverse(all(a)); a.PB(x); reverse(all(a)); } } vi longest_trip(int n, int d){ vi a = {0}, b = {1}; bool nula = 0; for(int i=2; i<n; i++){ if(are_connected({a.back()}, {i})){ a.PB(i); nula = 0; continue; } if(nula or are_connected({b.back()}, {i})){ b.PB(i); nula = 1; continue; } while(b.size()) a.PB(b.back()), b.PPB(); b.PB(i); } if(a.size() < b.size()) swap(a, b); if(!are_connected(a, b)) return a; nadi(b, a); nadi(a, {b.back()}); while(b.size()) a.PB(b.back()), b.PPB(); return a; }

Compilation message (stderr)

longesttrip.cpp: In function 'void nadi(vi&, vi)':
longesttrip.cpp:38:6: error: 'are_connected' was not declared in this scope
   38 |   if(are_connected(a, b)) ret = mid, hi = mid - 1;
      |      ^~~~~~~~~~~~~
longesttrip.cpp: In function 'vi longest_trip(int, int)':
longesttrip.cpp:57:6: error: 'are_connected' was not declared in this scope
   57 |   if(are_connected({a.back()}, {i})){
      |      ^~~~~~~~~~~~~
longesttrip.cpp:63:14: error: 'are_connected' was not declared in this scope
   63 |   if(nula or are_connected({b.back()}, {i})){
      |              ^~~~~~~~~~~~~
longesttrip.cpp:73:6: error: 'are_connected' was not declared in this scope
   73 |  if(!are_connected(a, b)) return a;
      |      ^~~~~~~~~~~~~