Submission #1226078

#TimeUsernameProblemLanguageResultExecution timeMemory
1226078paskalisapoFun Tour (APIO20_fun)C++20
Compilation error
0 ms0 KiB
#include "fun.h" #include <bits/stdc++.h> #include <vector> using namespace std; stack<int> s; vector<vector<pair<int,int>>> adj; vector<int> v; bool valid = false; int n; void dfs(int cur, int par, int mw) { for(auto &x : adj[cur]) { if(x.first == par || x.second > mw) { continue; } dfs(x.first, cur, x.second); s.push(x.first); } if(s.size() == n) { while(!s.empty()) { v.push_back(s.top()); s.pop(); } valid = true; return; } else { s.pop(); } } std::vector<int> createFunTour(int N, int Q) { int H = hoursRequired(0, N - 1); int A = attractionsBehind(0, N - 1); return std::vector<int>(N); n = N; adj.resize(N); for(int i = 0;i < N ; i++){ for(int j = i + 1; j < N ;j ++) { int temp = hoursRequired(i , j); if(attractionsBehind(i, j) == 0) { adj[i].push_back({j, temp}); adj[j].push_back({i , temp}); } } } for(int i = 0 ;i < N ;i++) { dfs(i , INT_MAX); if(valid) { break; } } reverse(v.begin(), v.end()); for(auto &x : v) { cout << x << " "; } cout << endl; }

Compilation message (stderr)

fun.cpp: In function 'std::vector<int> createFunTour(int, int)':
fun.cpp:51:12: error: too few arguments to function 'void dfs(int, int, int)'
   51 |         dfs(i , INT_MAX);
      |         ~~~^~~~~~~~~~~~~
fun.cpp:11:6: note: declared here
   11 | void dfs(int cur, int par, int mw) {
      |      ^~~