Submission #997033

#TimeUsernameProblemLanguageResultExecution timeMemory
997033daffuwuCloud Computing (CEOI18_clo)C++14
18 / 100
2 ms3672 KiB
#include <bits/stdc++.h> using namespace std; #define fr first #define sc second mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); long long n, m, dp[2069][2069]; struct machine { long long c, f, v; bool operator<(const machine other) const { return f<other.f; } } a[2069], b[2069]; int main() { long long i, j; scanf("%lld", &n); for (i=1; i<=n; i++) { scanf("%lld%lld%lld", &a[i].c, &a[i].f, &a[i].v); } scanf("%lld", &m); for (i=1; i<=m; i++) { scanf("%lld%lld%lld", &b[i].c, &b[i].f, &b[i].v); } sort(a+1, a+n+1); sort(b+1, b+m+1); for (i=n; i>=1; i--) { for (j=m; j>=1; j--) { dp[i][j] = max(dp[i+1][j], dp[i][j+1]); if (a[i].f>=b[j].f) dp[i][j] = max(dp[i][j], dp[i+1][j+1]+b[j].v-a[i].v); //order j di-assign ke komputer i } } printf("%lld\n", dp[1][1]); }

Compilation message (stderr)

clo.cpp: In function 'int main()':
clo.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     scanf("%lld", &n);
      |     ~~~~~^~~~~~~~~~~~
clo.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         scanf("%lld%lld%lld", &a[i].c, &a[i].f, &a[i].v);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clo.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |     scanf("%lld", &m);
      |     ~~~~~^~~~~~~~~~~~
clo.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |         scanf("%lld%lld%lld", &b[i].c, &b[i].f, &b[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...