Submission #1228120

#TimeUsernameProblemLanguageResultExecution timeMemory
1228120arkanefuryExhibition (JOI19_ho_t2)C++20
100 / 100
36 ms9936 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define in insert #define lb lower_bound #define F first #define S second #define sz size() #define int long long #define all(v) v.begin(),v.end() #define FOR1(x, n) for(int j = x; j <= n; j ++) #define FOR(x, n, m, d) for(int x = n; x <= m; x += d) #define FORR(x, n, m, d) for(int x = n; x >= m; x -= d) #define nikita ios_base::sync_with_stdio(0), cin.tie(0); const int N = 3e5+5; int a[N], b[N], pref[N], d[N],ans, inf = 1e18, par = 0, c[N], dp[N], suf[N]; int n,m,k,sum=0,x,y, r, cnt, l, mod = 1e9+7; vector<int>g[N]; void solve() { nikita cin >> n >> m; vector<pair<int,int>>v; FOR(i, 1, n, 1){ cin >> x >> y; v.pb({y, x}); } sort(all(v)); FOR(i,1 , m, 1)cin >> a[i]; sort(a+1, a+m+1); x = m; while(x != 0 && v.sz){ if(a[x] >= v.back().S){ x --; v.pop_back(); ans ++; } else v.pop_back(); } cout << ans; } signed main(){ nikita int tt = 1; if(!tt)cin >> tt; FOR(i, 1, tt, 1)solve(); } /* dp[i][j] = min x, where last a[j] equal to x otherwise dp[i][j] = inf dp[1][1] = l[1]; for(i, 1, n, 1)dp[i][1] = l[i]; for(j, 1, n, 1)dp[i][j] = dp[i-1][j]; dp[i][j] <= dp[i][j+1] && dp[i][j] >= dp[i+1][j] for(j, 1, i-1, 1){ if(dp[i-1][j-1] <= r[i])dp[i][j] = min(dp[i][j], max(l[i], dp[i-1][j-1])) dp[i][j] = min(dp[i][j], dp[i-1][j-1]) } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...