Submission #217588

#TimeUsernameProblemLanguageResultExecution timeMemory
217588DystoriaXCloud Computing (CEOI18_clo)C++14
18 / 100
6 ms1408 KiB
#include <bits/stdc++.h> using namespace std; struct node{ int c, f, v; }; int n, m; vector<node> comp, dem; priority_queue<int, vector<int>, greater<int> > pq; long long ans = 0, dp[251][251]; bool cp(node a, node b){ return a.f > b.f; } int main(){ scanf("%d", &n); comp.resize(n + 1); for(int i = 1; i <= n; i++) scanf("%d%d%d", &comp[i].c, &comp[i].f, &comp[i].v); scanf("%d", &m); dem.resize(m + 1); for(int i = 1; i <= m; i++) scanf("%d%d%d", &dem[i].c, &dem[i].f, &dem[i].v); sort(comp.begin() + 1, comp.end(), cp); sort(dem.begin() + 1, dem.end(), cp); for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ dp[i][j] = max(dp[i][j], dp[i - 1][j]); dp[i][j] = max(dp[i][j], dp[i][j - 1]); if(comp[i].f >= dem[j].f) dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + dem[j].v - comp[i].v); } } printf("%lld\n", dp[n][m]); return 0; }

Compilation message (stderr)

clo.cpp: In function 'int main()':
clo.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
clo.cpp:22:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= n; i++) scanf("%d%d%d", &comp[i].c, &comp[i].f, &comp[i].v);
                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clo.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &m);
     ~~~~~^~~~~~~~~~
clo.cpp:27:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= m; i++) scanf("%d%d%d", &dem[i].c, &dem[i].f, &dem[i].v);
                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...