제출 #1273736

#제출 시각아이디문제언어결과실행 시간메모리
1273736nthvnExhibition (JOI19_ho_t2)C++20
0 / 100
1 ms576 KiB
#include "bits/stdc++.h" using namespace std; #define LOG(n) (63 - __builtin_clzll((n))) #define fi first #define se second #define pii pair<int,int> #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() #define pb push_back #define ll long long const int inf = 1e9+7; const int N = 1e5+5; int n,m,tot; pii a[N]; bool cmp(pii &a, pii &b){ return a.se < b.se; } void sort_array(){ sort(a+1,a+tot+1); int last = 0; for(int i=1;i<=tot;i++){ if(a[i].se==inf){ if(last+1<i) sort(a+last+1,a+i,cmp); last = i; } } // for(int i=1;i<=tot;i++) { // cerr<<a[i].fi<<" "; // if(a[i].se!=inf) cerr<<a[i].se; // cerr<<"\n"; // } } signed main(){ ios_base::sync_with_stdio(NULL); cin.tie(NULL); 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++) { int x,y; cin>>x>>y; a[++tot] = {x,y}; } for(int i=1;i<=m;i++) cin>>a[++tot].fi, a[tot].se = inf; sort_array(); // cerr<<'\n'; multiset<int> st; int sz =0; for(int i=tot;i>=1;i--){ if(a[i].se==inf) sz++; else{ auto it = st.lower_bound(a[i].se); if(it!=st.begin()) { advance(it,-1); st.erase(it); st.insert(a[i].se); } else{ if(sz(st)<sz) st.insert(a[i].se); } } // cerr<<i<<" "<<sz(st)<<"\n"; } // cerr<<sz; cout<<sz(st); }

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:42:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |                 freopen("TASK.INP", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:43:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |                 freopen("TASK.OUT", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...