Submission #542011

#TimeUsernameProblemLanguageResultExecution timeMemory
542011Cookie197Exhibition (JOI19_ho_t2)C++17
50 / 100
9 ms4308 KiB
#include<iostream> #include<vector> #include<algorithm> #include<set> #include<map> using namespace std; #define ll long long #define endl "\n" #define mp make_pair #define out(x) cout<< #x << " = " << x << endl #define pii pair<int,int> #pragma GCC optimize("Ofast") int n,m; pii paint[1004]; int frame[1004]; int dp[1004][1004]; bool comp(pii a,pii b){ if (a.second != b.second) return a.second < b.second; return a.first < b.first; } signed main(){ ios::sync_with_stdio(false); cin.tie(0); cin>>n>>m; for (int i=1;i<=n;i++){ cin>>paint[i].first>>paint[i].second; } for (int i=1;i<=m;i++) cin>>frame[i]; sort(frame+1,frame+1+m); sort(paint+1,paint+1+n,comp); for (int i=1;i<=n;i++) for (int j=1;j<=m;j++){ if (paint[i].first <= frame[j]) dp[i][j] = dp[i-1][j-1] + 1; dp[i][j] = max(dp[i][j], max(dp[i-1][j], dp[i][j-1])); } cout<<dp[n][m]<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...