Submission #951789

#TimeUsernameProblemLanguageResultExecution timeMemory
951789SmuggingSpunExhibition (JOI19_ho_t2)C++14
0 / 100
0 ms348 KiB
#include<bits/stdc++.h> #define taskname "exhibition" using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } int n, m; cin >> n >> m; vector<pair<int, int>>a(n); for(auto& [x, y] : a){ cin >> x >> y; } sort(a.begin(), a.end(), [&] (auto i, auto j) -> bool{ return i.second < j.second || (i.second == j.second && i.first < j.first); }); vector<int>c(m); for(int& x : c){ cin >> x; } sort(c.begin(), c.end(), greater<int>()); int low = 1, high = m, ans; while(low <= high){ int mid = (low + high) >> 1; for(int i = mid - 1, p = 0; i > -1; i--){ while(p < n && a[p].first > c[i]){ p++; } if(p < n){ p++; } else{ high = mid - 1; break; } } if(high != mid - 1){ low = (ans = mid) + 1; } } cout << ans; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:12:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   12 |  for(auto& [x, y] : a){
      |            ^
joi2019_ho_t2.cpp:7:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |   freopen(taskname".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:42:10: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   42 |  cout << ans;
      |          ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...