Submission #293415

#TimeUsernameProblemLanguageResultExecution timeMemory
293415BeanZExhibition (JOI19_ho_t2)C++14
100 / 100
56 ms5632 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' const int N = 1e5 + 5; pair<ll, ll> a[N]; ll b[N]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); if (fopen("balance.in", "r")){ freopen("balance.in", "r", stdin); freopen("balance.out", "w", stdout); } ll n, m; cin >> n >> m; for (int i = 1; i <= n; i++){ ll s, v; cin >> s >> v; a[i] = {v, s}; } sort(a + 1, a + n + 1); for (int i = 1; i <= m; i++) cin >> b[i]; sort(b + 1, b + m + 1); ll now = m; ll ans = 0; for (int i = n; i >= 1; i--){ if (a[i].second <= b[now]){ ans++; now--; } } cout << ans; } /* */

Compilation message (stderr)

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