Submission #572251

#TimeUsernameProblemLanguageResultExecution timeMemory
572251PiejanVDCExhibition (JOI19_ho_t2)C++17
0 / 100
1 ms304 KiB
#include <bits/stdc++.h> using namespace std; signed main() { int n,m; cin>>n>>m; vector<pair<int,int>>v(n); for(auto &z : v) { cin>>z.second>>z.first; } sort(v.begin(),v.end()); vector<int>c(m); for(auto &z : c) { cin>>z; } sort(c.begin(),c.end()); int ans = 0; int dp[n+5][m+5]; for(int i = 0 ; i <= m ; i++) dp[0][i] = 0; for(int i = 0 ; i <= n ; i++) dp[i][0] = 0; for(int i = 1 ; i <= n ; i++) { for(int j = 1 ; j <= m ; j++) { dp[i][j] = dp[i][j-1]; if(v[i-1].second <= c[j-1]) dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1); } } cout << dp[n][m]; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:16:7: warning: unused variable 'ans' [-Wunused-variable]
   16 |   int ans = 0;
      |       ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...