Submission #110328

#TimeUsernameProblemLanguageResultExecution timeMemory
110328luciocfExhibition (JOI19_ho_t2)C++14
0 / 100
6 ms4352 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3+10; struct P { int s, v; } a[maxn]; int c[maxn]; int n, m; int dp[maxn][maxn]; bool comp(P a, P b) { return a.v < b.v; } int solve(int i, int j) { if (i == n+1 || j == m+1) return 0; if (dp[i][j] != -1) return dp[i][j]; int ans = 0; if (a[i].s <= c[j]) ans = max(ans, 1+solve(i+1, j+1)); ans = max({ans, solve(i+1, j), solve(i, j+1)}); } int main(void) { scanf("%d %d", &n, &m); for (int i = 1; i <= n; i++) scanf("%d %d", &a[i].s, &a[i].v); for (int i = 1; i <= m; i++) scanf("%d", &c[i]); sort(a+1, a+n+1, comp); sort(c+1, c+m+1); memset(dp, -1, sizeof dp); printf("%d\n", solve(1, 1)); }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int solve(int, int)':
joi2019_ho_t2.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:38:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:41:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &a[i].s, &a[i].v);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:44:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &c[i]);
   ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...