제출 #1273768

#제출 시각아이디문제언어결과실행 시간메모리
1273768baotoan655Exhibition (JOI19_ho_t2)C++20
100 / 100
36 ms1600 KiB
#include <bits/stdc++.h>
#define file(name)  if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
using namespace std;
const int N = 1e5 + 5;
int n, m;
pair<int, int> a[N];
int Q[N];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    file("A") else file("task");
    cin >> n >> m;
    for(int i = 1; i <= n; ++i) cin >> a[i].first >> a[i].second;
    for(int i = 1; i <= m; ++i) cin >> Q[i];
    sort(Q + 1, Q + m + 1, greater<int>());
    sort(a + 1, a + n + 1, [&](pair<int, int> x, pair<int, int> y) {
        if(x.second != y.second) return x.second > y.second;
        return x.first > y.first;
    });
    long long ans = 0;
    int j = 1;
    for(int i = 1; i <= n; ++i) {
        if(j <= m && a[i].first <= Q[j]) {
            ans ++;
            ++j;
        }
    }
    cout << ans << '\n';
    return 0;
}

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:2:58: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    2 | #define file(name)  if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
      |                                                   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:12:5: note: in expansion of macro 'file'
   12 |     file("A") else file("task");
      |     ^~~~
joi2019_ho_t2.cpp:2:91: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    2 | #define file(name)  if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
      |                                                                                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:12:5: note: in expansion of macro 'file'
   12 |     file("A") else file("task");
      |     ^~~~
joi2019_ho_t2.cpp:2:58: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    2 | #define file(name)  if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
      |                                                   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:12:20: note: in expansion of macro 'file'
   12 |     file("A") else file("task");
      |                    ^~~~
joi2019_ho_t2.cpp:2:91: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    2 | #define file(name)  if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
      |                                                                                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:12:20: note: in expansion of macro 'file'
   12 |     file("A") else file("task");
      |                    ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...