Submission #1039554

#TimeUsernameProblemLanguageResultExecution timeMemory
1039554tamir1Exhibition (JOI19_ho_t2)C++17
50 / 100
147 ms13772 KiB
#include<bits/stdc++.h> #define ff first #define ss second using namespace std; int n,m,c[100005],i,j,dp[1005][1005]; pair<int,int> p[100005]; bool cmp(pair<int,int> a,pair<int,int> b){ if(a.ss==b.ss) return a.ff<b.ff; return a.ss<b.ss; } int main(){ cin >> n >> m; for(i=1;i<=n;i++){ cin >> p[i].ff >> p[i].ss; } for(i=1;i<=m;i++){ cin >> c[i]; } sort(p+1,p+n+1,cmp); sort(c+1,c+m+1); for(i=1;i<=m;i++){ for(j=1;j<=n;j++){ if(c[i]>=p[j].ff) dp[i][j]=dp[i-1][j-1]+1; else dp[i][j]=dp[i][j-1]; } } cout << dp[m][n]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...