Submission #139688

#TimeUsernameProblemLanguageResultExecution timeMemory
139688duckmoon99Exhibition (JOI19_ho_t2)C++14
50 / 100
246 ms10232 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace std::chrono; using namespace __gnu_pbds; #define fi first #define se second #define mp make_pair #define pb push_back #define fbo find_by_order #define ook order_of_key typedef long long ll; typedef pair<ll,ll> ii; typedef vector <ii> vii; typedef vector<ll> vi; typedef long double ld; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; typedef set<int>::iterator sit; typedef map<int,int>::iterator mit; typedef vector<int>::iterator vit; ll dp[2][1001],cc; vi c; vii paint; ii s; int main(){ int n,m;cin>>n>>m; for(int i = 0; i < n; i++){ cin >> s.se >> s.fi; paint.pb(s); } sort(paint.begin(),paint.end()); for(int i = 0; i < m; i++){ cin >> cc; c.pb(cc); } c.pb(0); sort(c.begin(),c.end()); ll ans=0; for(int i = 0; i < n; i++){ for(int j = 1; j <= m; j++){ dp[i%2][j]=dp[(i+1)%2][j]; if(paint[i].se<=c[j]) dp[i%2][j]=max(dp[i%2][j],dp[(i+1)%2][j-1]+1); ans=max(ans,dp[i%2][j]); } } cout<<ans<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...