Submission #727036

#TimeUsernameProblemLanguageResultExecution timeMemory
727036Bogdan1110Exhibition (JOI19_ho_t2)C++14
100 / 100
61 ms4800 KiB
#include <bits/stdc++.h> #define FAST {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);} #define FILES {freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);} #define ll long long #define ull unsigned long long #define pqueue priority_queue #define pb push_back #define fi first #define se second #define ld long double #define pii pair<int,int> #define pll pair<long long,long long> #define all(a) (a).begin(), (a).end() #define mp make_pair using namespace std; // order_of_key -> # less than k // find_by_order -> k-th element // pq max element void files() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } const double eps = 0.00000001; const int NMAX = 100010; const ll inf = LLONG_MAX/3; const ll modi = 998244353; void solve() { int n,m; cin >> n >> m; vector<pii>v(n); vector<int>c(m,0); for (int i = 0; i < n ; i++ ) { cin >> v[i].se >> v[i].fi; } sort(all(v)); for (int i = 0 ; i < m ; i++ ) { cin >> c[i]; } sort(all(c)); vector<int>res(n+1,INT_MAX); int cnt = m-1; for (int i = n-1 ; i >=0 ; i-- ) { if ( cnt < 0 ) break; if ( c[cnt] >= v[i].se ) { //cout << c[cnt] << ' ' << v[i].fi << ' ' << v[i].se << endl; cnt--; } } cout << m - cnt -1 << endl; } int main () { FAST int t=1; /* cin >> t; //*/ int i = 1; while(t--) { //cout << "Case #" << i++ << ": " ; solve(); } }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:74:9: warning: unused variable 'i' [-Wunused-variable]
   74 |     int i = 1;
      |         ^
joi2019_ho_t2.cpp: In function 'void files()':
joi2019_ho_t2.cpp:22:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...