Submission #1023843

#TimeUsernameProblemLanguageResultExecution timeMemory
1023843vjudge1Exhibition (JOI19_ho_t2)C++17
100 / 100
44 ms4688 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define task "code" const int ar=1e5+5; const ll mod=1e9+7; int n,m; pair<int,int> pic[ar]; int c[ar]; int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); if (fopen(task".inp","r")) { freopen(task".inp","r",stdin); freopen(task".out","w",stdout); } cin>>n>>m; for (int i=1;i<=n;i++) { cin>>pic[i].se>>pic[i].fi; } for (int i=1;i<=m;i++) { cin>>c[i]; } sort(c+1,c+m+1); sort(pic+1,pic+n+1); int ans=0; int pos=m; for (int i=n;i>=1;i--) { int s=pic[i].se; if (c[pos]>=s) ans++,pos--; if (ans==m) return cout<<m,0; } cout<<ans; }

Compilation message (stderr)

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