Submission #1097507

#TimeUsernameProblemLanguageResultExecution timeMemory
1097507NurislamExhibition (JOI19_ho_t2)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> using namespace std; //using namespace __gnu_pbds;z #define pb push_back #define ff first #define ss second #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define int long long //#define ordst tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag , tree_order_statistics_node_update > //#define double long double template <class F, class _S> bool chmin(F &u, const _S &v){ bool flag = false; if ( u > v ){ u = v; flag |= true; } return flag; } template <class F, class _S> bool chmax(F &u, const _S &v){ bool flag = false; if ( u < v ){ u = v; flag |= true; } return flag; } const int N = (1<<18) +1, inf = 1e18+200; //int mod = 998244353; //int mod = 1000000007; //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //#define rnd(l, r) uniform_int_distribution <int> (l, r)(rng) void solve(){ int n, m; cin >> n >> m; vector<array<int,2>> pic(n); for(auto &[i, j]:pic)cin >> j >> i; sort(rall(pic)); vector<int> siz(m); for(int &i:siz)cin >> i; sort(rall(siz)); // vector<array<int,3>> dp = {{inf,inf,0}}; int ans = 0; for(auto [va, sz]:pic){ int res = 0; for(auto [sz1, val, tot]:dp){ if(sz1 >= sz && val >= va){ if(tot < m && sz <= siz[tot]){ chmax(res, tot + 1); chmax(ans, res); } } } if(res)dp.pb({sz, va, res}); } //for(auto [s1, s2, s3]:dp)cout << s1 << ' ' << s2 << ' ' << s3 << '\n'; cout << ans << '\n'; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int tt = 1; //cin >> tt; while(tt--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...