Submission #347583

#TimeUsernameProblemLanguageResultExecution timeMemory
347583happypotatoTravelling Merchant (APIO17_merchant)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define ff first #define ss second #define pb push_back #define eb emplace_back using namespace std; const int mxN = 101, mxK = 1001; vector<pii> adj[mxN]; int a[mxN][mxK][2]; int n, m, k; void subtask1(), subtask2(), subtask3(), subtask4(); void solve(int case_no) { // implementation cin >> n >> m >> k; bool subtask[3] = {true, true, true}; for (int i = 1;i <= n;i++) { for (int j = 1;j <= k;j++) { cin >> a[i][j][0] >> a[i][j][1]; if (i != -1 && a[i][j][0] != -1) subtask[0] = false; } } for (int i = 1;i <= m;i++) { int u, v, w; cin >> u >> v >> w; adj[u].eb(v, w); } if (subtask[0]) return subtask1(); } int dfs(int u, int ptr, int dist, int maxi) { if (u == 1 && dist != 0) { return (maxi) / dist; } maxi = max(maxi, a[u][ptr][1] - a[1][ptr][0]); int ans = 0; for (pii v : adj[u]) { ans = max(ans, dfs(v.ff, ptr, dist + v.ss, maxi)); } return ans; } void subtask1() { int ans = 0; for (int i = 1;i <= k;i++) { ans = max(ans, dfs(1, i, 0, 0)); } cout << ans << endl; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); srand(time(NULL)); init(); int t = 1; // cin >> t; for (int i = 1;i <= t;i++) solve(i); } /* */

Compilation message (stderr)

merchant.cpp: In function 'int main()':
merchant.cpp:54:5: error: 'init' was not declared in this scope; did you mean 'int'?
   54 |     init();
      |     ^~~~
      |     int