Submission #786137

#TimeUsernameProblemLanguageResultExecution timeMemory
786137makanhuliaExhibition (JOI19_ho_t2)C++17
100 / 100
50 ms2752 KiB
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pii pair<int,int> #define pll pair<long long, long long> // jangan kebiasa kalah // kalo OI, sampah aja dulu, tapi jangan menutup kemungkinan buat AC long long n,m,b[100069],ans; pll arr[100069]; int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); long long i,j; cin>>n>>m; for(i=1;i<=n;i++) { cin>>arr[i].se>>arr[i].fi; } j = m; bool pernah = 0; for(i=1;i<=m;i++) { cin>>b[i]; } sort(arr+1,arr+n+1); sort(b+1,b+m+1); // i < j -> b[i] <= b[j] and arr[i].fi <= arr[j].fi // fi = val, se = size for(i=n;i and j;i--) { if(arr[i].se <= b[j]) { --j; ++ans; } } cout<<ans<<'\n'; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:25:10: warning: unused variable 'pernah' [-Wunused-variable]
   25 |     bool pernah = 0;
      |          ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...