제출 #1223176

#제출 시각아이디문제언어결과실행 시간메모리
1223176fermatExhibition (JOI19_ho_t2)C++20
100 / 100
54 ms5900 KiB
/**
 GOT A FEELING THAT I"M GOING UNDER
**/
#include <bits/stdc++.h>

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 1e5 + 5;

int n, m, x, y, c[N], ans, last = 1e9 + 7;

multiset < pair <int, int>, greater < pair <int, int> > > st;

main(){
 cin >> n >> m;
 
 for (int i = 1; i <= n; i++) {
  scanf("%d%d", &x, &y);
  st.insert( mk( y, x ) );
 }
 for (int i = 1; i <= m; i++) {
  scanf("%d", &c[i]);
 }
 sort(c + 1, c + m + 1);
 
 for (int i = m; i >= 1; i--) {
  
  while (!st.empty() && st.begin()->sc > c[i])
   st.erase(st.begin());
  
  if (st.empty()) break;
 
  st.erase(st.begin());
  ans++;
 }
 cout << ans << endl;
}

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

joi2019_ho_t2.cpp:20:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   20 | main(){
      | ^~~~
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |   scanf("%d%d", &x, &y);
      |   ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |   scanf("%d", &c[i]);
      |   ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...