Submission #1112078

#TimeUsernameProblemLanguageResultExecution timeMemory
1112078euekaExhibition (JOI19_ho_t2)C++14
0 / 100
1 ms2384 KiB
#include <bits/stdc++.h> #define NAME "BWTREE" #define ll long long #define ii pair<ll, ll> #define mo(i, a, b) for (int i = a; i <= b; i++) #define me(i, a, b) for (int i = a; i >= b; i--) #define bit(mask, i) ((mask >> i) & 1) #define TIME (1.0 * clock() / CLOCKS_PER_SEC) const ll N = 1e6 + 5; const ll mod = 1e9 + 7; const ll base = 31; const ll inf = 1e18; using namespace std; ii a[N]; ll c[N], n, m; ll check(ll k){ ll j = m - k; mo(i, 1, n){ if(j == m) break; if(a[i].first <= c[j]) j++; } return j == m; } int main() { ///freopen(NAME".inp", "r", stdin); ///freopen(NAME".out", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; mo(i, 1, n) cin >> a[i].first >> a[i].second; mo(i, 1, m) cin >> c[i]; sort(a + 1, a + n + 1); sort(c + 1, c + m + 1); ll l = 0, r = min(n, m); while(r - l > 1){ ll mid = l + r >> 1; if(check(mid)) l = mid; else r = mid; } cout << l << "\n"; cerr << "Time elapsed: " << TIME << "s.\n"; return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:38:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   38 |         ll mid = l + r >> 1;
      |                  ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...