Submission #538460

#TimeUsernameProblemLanguageResultExecution timeMemory
538460blueJourney (NOI18_journey)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> using namespace std; using ll = long long; using pii = pair<int, int>; int main() { int n, m, h; cin >> n >> m >> h; vector<pii> edge[n]; // cerr << "done\n"; for(int i = 0; i < n-1; i++) { for(int e = 0; e < h; e++) { int j, w; cin >> j >> w; if(j <= i) continue; edge[i].push_back({j, w}); } sort(edge[i].begin(), edge[i].end(), [] (pii x, pii y) { return x.second < y.second; }); } int dp[m][n]; for(int d = 0; d < m; d++) for(int i = 0; i < n; i++) dp[d][i] = 0; dp[0][0] = 1; for(int d = 0; d < m; d++) { for(int i = 0; i < n; i++) { if(d >= 1) { dp[d][i] = min(5'0000'0001, dp[d-1][i] + dp[d][i]); } for(pii e : edge[i]) { if(d + e.second >= m) break; dp[d + e.second][e.first] = min(5'0000'0001, dp[d + e.second][e.first] + dp[d][i]); } } } cout << dp[0][n-1] << ' '; // for(int d ) for(int d = 1; d < m-1; d++) cout << dp[d][n-1] - dp[d-1][n-1] << ' '; cout << '\n'; }

Compilation message (stderr)

journey.cpp: In function 'int main()':
journey.cpp:27:3: error: 'sort' was not declared in this scope; did you mean 'qsort'?
   27 |   sort(edge[i].begin(), edge[i].end(), [] (pii x, pii y)
      |   ^~~~
      |   qsort