제출 #209201

#제출 시각아이디문제언어결과실행 시간메모리
209201kostia244Exhibition (JOI19_ho_t2)C++17
50 / 100
494 ms13820 KiB
#include<bits/stdc++.h> #define all(x) x.begin(), x.end() #define pb push_back using namespace std; using ll = long long; using vi = vector<ll>; using pi = pair<ll, ll>; const int maxn= 1030; int n, m, dp[maxn][maxn]; vector<pi> a; vi b; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> m; a.resize(n); b.resize(m); for(int i = 0; i < n; i++) cin >> a[i].second >> a[i].first; for(int i = 0; i < m; i++) cin >> b[i]; sort(all(a)); sort(all(b)); memset(dp, -0x3f, sizeof dp); dp[0][0] = 0; for(int i = 0; i <= n; i++) { for(int j = 0; j <= m; j++) { dp[i+1][j] = max(dp[i][j], dp[i+1][j]); dp[i][j+1] = max(dp[i][j], dp[i][j+1]); if(i<n&&j<m&&a[i].second<=b[j]) dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1); } } cout << dp[n][m]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...