제출 #1352152

#제출 시각아이디문제언어결과실행 시간메모리
1352152top1svtinExhibition (JOI19_ho_t2)C++17
100 / 100
28 ms2784 KiB
#include <bits/stdc++.h>

#define kien long long
#define int long long
#define FOR(i, a, b) for (int i = a;i <= b; i++)
#define FORD(i, a, b) for (int i = a;i >= b; i--)
#define task "a"
#define fin(x) freopen(x".inp","r",stdin)
#define fou(x) freopen(x".out","w",stdout)
#define pii pair <int, int>

using namespace std;
const int mxn = 1e5 + 5;
kien n, m, c[mxn], ans;
pii a[mxn];
bool cmp (pii x, pii y) {
    return x.second < y.second;
}

main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if (fopen(task".inp", "r")) {
        fin(task); fou(task);
    }
    cin >> n >> m;
//    vector <int> zip;
    FOR (i, 1, n) {
        cin >> a[i].second >> a[i].first;
//        zip.pb(a[i].first); zip.pb(a[i].second);
    }

    FOR (i, 1, m) cin >> c[i];// zip.pb(c[i]);
//    sort (zip.begin(), zip.end());
//    zip.erase(unique(zip.begin(), zip.end()), zip.end());
//    FOR (i, 1, n) {
//        a[i].first = lower_bound(zip.begin(), zip.end(), a[i].first) - zip.begin() + 1;
//        a[i].second = lower_bound(zip.begin(), zip.end(), a[i].second) - zip.begin() + 1;
//        vec[a[i].first].pb(a[i].second);
//    }
//    FOR (i, 1, m) c[i] = lower_bound(zip.begin(), zip.end(), c[i]) - zip.begin() + 1; pp[c[i]]++;
//
    sort (c + 1, c + 1 + m);
    sort (a + 1, a + 1 + n);

    for (int i = m, j = n; i >= 1; i--) {
        while (c[i] < a[j].second and j >= 1) {
            j--;
        }
        if (j >= 1)
            ans++, j--;
    }

    cout << ans;
}

컴파일 시 표준 에러 (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:8:23: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 | #define fin(x) freopen(x".inp","r",stdin)
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:24:9: note: in expansion of macro 'fin'
   24 |         fin(task); fou(task);
      |         ^~~
joi2019_ho_t2.cpp:9:23: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 | #define fou(x) freopen(x".out","w",stdout)
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:24:20: note: in expansion of macro 'fou'
   24 |         fin(task); fou(task);
      |                    ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...