Submission #128433

# Submission time Handle Problem Language Result Execution time Memory
128433 2019-07-10T22:44:50 Z dragonslayerit Exhibition (JOI19_ho_t2) C++14
0 / 100
2 ms 380 KB
#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;
}

Compilation message

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 time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Incorrect 2 ms 376 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Incorrect 2 ms 376 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Incorrect 2 ms 376 KB Output isn't correct
8 Halted 0 ms 0 KB -