제출 #522651

#제출 시각아이디문제언어결과실행 시간메모리
522651MonarchuwuExhibition (JOI19_ho_t2)C++17
100 / 100
54 ms1536 KiB
// sort các tranh giảm theo V, bằng V giảm S
// sort các khung giảm theo C
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

typedef pair<int, int> pii;
#define ff first
#define ss second

const int N = 1e5 + 9;
int n, m;
pii a[N];
int c[N];

int main() {
    cin.tie(NULL)->sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) cin >> a[i].ss >> a[i].ff;
    for (int i = 1; i <= m; ++i) cin >> c[i];
    sort(a + 1, a + n + 1, greater<pii>());
    sort(c + 1, c + m + 1, greater<int>());

    int ans(0);
    for (int i = 1, p; i <= n && ans < m; ++i)
        if (c[ans + 1] >= a[i].ss) ++ans; // cho dùng khung thứ ans+1
    cout << ans << '\n';
}
/**  /\_/\
 *  (= ._.)
 *  / >0  \>1
**/

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:26:21: warning: unused variable 'p' [-Wunused-variable]
   26 |     for (int i = 1, p; i <= n && ans < m; ++i)
      |                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...