제출 #100837

#제출 시각아이디문제언어결과실행 시간메모리
100837ikura355Exhibition (JOI19_ho_t2)C++14
0 / 100
2 ms384 KiB
#include<bits/stdc++.h> using namespace std; #define pii pair<int,int> #define X first #define Y second const int maxn = 1e5 + 5; const int inf = 2e9; int n,m; pii a[maxn]; int b[maxn]; int wow[maxn], p[maxn]; int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) scanf("%d%d",&a[i].X,&a[i].Y); for(int i=1;i<=m;i++) scanf("%d",&b[i]); sort(&a[1],&a[n+1]); sort(&b[1],&b[m+1],[&](int x, int y){return x>y;}); for(int i=n,j=0;i>=1;i--) { while(j+1<=m && b[j+1]>=a[i].X) j++; a[i].X = j; //printf("wow %d %d = %d\n",a[i].X,a[i].Y,wow[i]); } sort(&a[1],&a[n+1]); int mx = 0; p[0] = inf; for(int i=n;i>=1;i--) { int l = 0, r = mx, pos = 0; while(l<=r) { int mid = (l+r)/2; if(p[mid]>=a[i].Y) { pos = mid+1; l = mid+1; } else r = mid-1; } if(pos<=a[i].X) { p[pos] = a[i].Y; mx = max(mx, pos); } } printf("%d",mx); }

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t2.cpp:19:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf("%d%d",&a[i].X,&a[i].Y);
                        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:20:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=m;i++) scanf("%d",&b[i]);
                        ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...