Submission #1050914

#TimeUsernameProblemLanguageResultExecution timeMemory
1050914manhlinh1501Exhibition (JOI19_ho_t2)C++17
100 / 100
32 ms4368 KiB
#include <bits/stdc++.h> using namespace std; using i64 = long long; using pii = pair<int, int>; const int MAXN = 1e5 + 5; int N, M; pii a[MAXN]; int b[MAXN]; signed main() { #define TASK "code" if (fopen(TASK ".inp", "r")) { freopen(TASK ".inp", "r", stdin); freopen(TASK ".out", "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N >> M; for(int i = 1; i <= N; i++) cin >> a[i].first >> a[i].second; for(int i = 1; i <= M; i++) cin >> b[i]; sort(a + 1, a + N + 1, [&](const pii a, const pii b) { if(a.second != b.second) return a.second < b.second; return a.first < b.first; }); sort(b + 1, b + M + 1); int j = N; int ans = 0; for(int i = M; i >= 1; i--) { while(j >= 1 and a[j].first > b[i]) j--; if(j > 0 and a[j].first <= b[i]) { j--; ans++; } } cout << ans; return (0 ^ 0); }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:13:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         freopen(TASK ".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:14:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         freopen(TASK ".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...