제출 #128433

#제출 시각아이디문제언어결과실행 시간메모리
128433dragonslayeritExhibition (JOI19_ho_t2)C++14
0 / 100
2 ms380 KiB
#include <cstdio>
#include <algorithm>
#include <tuple>

struct Pic{
  int s,v;
  void read(){
    scanf("%d %d",&s,&v);
  }
  bool operator<(Pic p)const{
    return std::tie(v,s)>std::tie(p.v,p.s);
  }
}pics[100005];
int cs[100005];

int main(){
  int N,M;
  scanf("%d %d",&N,&M);
  for(int i=0;i<N;i++){
    pics[i].read();
  }
  for(int i=0;i<M;i++){
    scanf("%d",&cs[i]);
  }
  std::sort(pics,pics+N);
  std::sort(cs,cs+M,std::greater<int>());
  int len=0;
  for(int i=0;i<N;i++){
    if(len<M&&pics[i].s<=cs[i]){
      len++;
    }
  }
  printf("%d\n",len);
  return 0;
}

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:18:8: 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:23:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&cs[i]);
     ~~~~~^~~~~~~~~~~~~
joi2019_ho_t2.cpp: In member function 'void Pic::read()':
joi2019_ho_t2.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&s,&v);
     ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...