Submission #957902

#TimeUsernameProblemLanguageResultExecution timeMemory
957902aykhnExhibition (JOI19_ho_t2)C++17
100 / 100
45 ms5808 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define inf 0x3F3F3F3F vector<int> st; void make(int l, int r, int x, int ind, int val) { if (l + 1 == r) { st[x] = max(st[x], val); return; } int mid = (l + r) >> 1; if (ind < mid) make(l, mid, 2*x + 1, ind, val); else make(mid, r, 2*x + 2, ind, val); st[x] = max(st[2*x + 1], st[2*x + 2]); } int get(int l, int r, int x, int lx, int rx) { if (l >= rx || r <= lx) return 0; if (l >= lx && r <= rx) return st[x]; int mid = (l + r) >> 1; return max(get(l, mid, 2*x + 1, lx, rx), get(mid, r, 2*x + 2, lx, rx)); } signed main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); int n, m, sz = 1; cin >> n >> m; int b[m]; array<int, 2> a[n]; for (array<int, 2> &x : a) cin >> x[1] >> x[0]; for (int &i : b) cin >> i; sort(a, a + n, greater<array<int, 2>> ()), sort(b, b + m); int res = 0; for (array<int, 2> &x : a) { if (x[1] <= b[m - res - 1]) { res++; if (res == m) break; } } cout << res << '\n'; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:34:15: warning: unused variable 'sz' [-Wunused-variable]
   34 |     int n, m, sz = 1;
      |               ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...