Submission #1167994

#TimeUsernameProblemLanguageResultExecution timeMemory
1167994SangLongest Trip (IOI23_longesttrip)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; i++) #define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; i--) #define fi first #define se second #define pb push_back #define ALL(a) (a).begin(), (a).end() #define task "kbsiudthw" typedef vector<int> vi; typedef pair<int, int> ii; typedef pair<int, ii> pii; const int N = 1e5 + 5; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 2277; vector<int> longest_trip(int n, int D){ if (D == 3){ vi ans; FOR (i, 0, n - 1) ans.pb(i); return ans; } if (D == 2){ deque<int> ans; ans.pb(0); vector<bool> marked(n, 0); marked[0] = 1; FOR (i, 1, n - 1){ if (are_connected({0}, {i})){ marked[i] = 1; ans.pb(i); break; } } FOR (i, 0, n - 1){ if (marked[i]) continue; if (are_connected({ans.front()}, {i})){ ans.push_front(i); } else ans.pb(i); } vi res; FOR (i, 0, n - 1) res.pb(i); return res; } } #ifdef _Pbrngw_ signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen(task".inp", "r")){ freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } return 0; } #endif // _Pbrngw_

Compilation message (stderr)

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:33:17: error: 'are_connected' was not declared in this scope; did you mean 'SYS_connect'?
   33 |             if (are_connected({0}, {i})){
      |                 ^~~~~~~~~~~~~
      |                 SYS_connect
longesttrip.cpp:41:17: error: 'are_connected' was not declared in this scope; did you mean 'SYS_connect'?
   41 |             if (are_connected({ans.front()}, {i})){
      |                 ^~~~~~~~~~~~~
      |                 SYS_connect
longesttrip.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
   49 | }
      | ^