# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
670300 | 2022-12-08T16:16:54 Z | dozer | Exhibition (JOI19_ho_t2) | C++14 | 2 ms | 340 KB |
#include <bits/stdc++.h> using namespace std; #define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout) #define fastio() cin.tie(0), ios_base::sync_with_stdio(0) #define pb push_back #define pii pair<int, int> #define st first #define nd second #define endl "\n" #define sp " " #define N 100005 #define LOGN 17 #define int long long int v[N], s[N], c[N]; int n, m; vector<int> pic, fra; int check(int x) { int i = 0, j = (m - x); while (i < n && j < m) { int a = pic[i], b = fra[j]; if (s[a] <= c[b]) i++, j++; else i++; } //cout<<endl; if (j == m) return 1; return 0; } int32_t main() { fileio(); fastio(); cin>>n>>m; for (int i = 1; i <= n; i++) cin>>s[i]>>v[i]; for (int i = 1; i <= m; i++) cin>>c[i]; for (int i = 1; i <= n; i++) pic.pb(i); for (int j = 1; j <= m; j++) fra.pb(j); sort(pic.begin(), pic.end(), [&](int a, int b){ return v[a] < v[b]; }); sort(fra.begin(), fra.end(), [&](int a, int b){ return c[a] < c[b]; }); int bound = min(n, m); int ans = 0; for (int i = LOGN; i >= 0; i--) { int tmp = ans + (1<<i); if (tmp <= bound && check(tmp)) ans = tmp; } cout<<ans<<endl; cerr<<"time taken : "<<(float)clock() / CLOCKS_PER_SEC<<" seconds\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |