제출 #844629

#제출 시각아이디문제언어결과실행 시간메모리
844629AlphaMale06Exhibition (JOI19_ho_t2)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> #define mp make_pair #define F first #define S second using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; pair<int, int> a[n]; int b[m]; for(int i=0; i< n; i++){ int x, y; cin >> x >> y; a[i]=mp(x, y); } for(int i=0; i< m; i++){ cin >> b[i]; } sort(b, b+m); sort(a, a+n); int l=0; int r=m; while(l<=r){ int s=(l+r)/2; int frst=m-s; multiset<int> st; int w=b[frst]; int ind; for(int i=0; i< n; i++){ if(a[i].F<=w){ st.insert(a[i].S); } else { ind=i; break; } } int cur; if(st.empty()){ r=s-1; continue; } else{ cur=*st.begin(); st.erase(st.find(cur)); } bool ok =true; for(int i=frst+1; i< m; i++){ w=b[i]; for(int j=ind; j<n; j++){ if(a[j].F<=w){ st.insert(a[j].S); } else{ ind=j; break; } } if(st.empty()){ ok=false; continue; } else{ if(*st.rbegin()<cur){ ok=false; continue; } else{ auto ptr=st.lower_bound(cur); st.erase(ptr); } } } if(ok){ l=s+1; } else{ r=s-1; } } cout << l-1 << '\n'; }

컴파일 시 표준 에러 (stderr) 메시지

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:32:13: warning: 'ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
   32 |         int ind;
      |             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...