Submission #759284

#TimeUsernameProblemLanguageResultExecution timeMemory
759284boyliguanhanTravelling Merchant (APIO17_merchant)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int calc[10][100][1000], b[10][100], s[10][100], N, k, m; vector<pair<int, int>> adj[5]; void dfs(int n, int item, int dist, int profit) { if(calc[n][item][dist]>=profit) continue; calc[n][item][dist] = profit; if(item) { if(s[n][item]>0) dfs(n, 0, dist, profit+s[n][item]); } else { for(int i = 1; i <= k; i++) dfs(n,i,dist,profit-b[n][i]); } for(auto i: adj[n]) { dfs(i.first, item, dist+i.second, profit); } } int main() { memset(calc, -2, sizeof calc); cin >> N >> k >> m; for(int i = 0; i < N; i++) { for(int j = 1; j <= k; j++) cin >> b[i][j]; for(int j = 1; j <= k; j++) cin >> s[i][j]; } while(m--) { int a, b, c; cin >> a >> b >> c; adj[a].push_back({b, c}); } dfs(0,0,0,0); int ans = 0; for(int i = 1; i < 100; i++) { ans = max(ans, calc[0][0][i]/i); } cout << ans << '\n'; }

Compilation message (stderr)

merchant.cpp: In function 'void dfs(int, int, int, int)':
merchant.cpp:6:37: error: continue statement not within a loop
    6 |     if(calc[n][item][dist]>=profit) continue;
      |                                     ^~~~~~~~