제출 #1023831

#제출 시각아이디문제언어결과실행 시간메모리
1023831vjudge1Exhibition (JOI19_ho_t2)C++17
100 / 100
42 ms4520 KiB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define eb emplace_back
#define task ""
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define nx freopen (task".inp","r",stdin), freopen (task".out","w",stdout);
#define fi first
#define se second
#define pii pair <int, int>
#define tii tuple <int, int, int>
#define all(s) s.begin(), s.end()
using namespace std;

const int nmax = 1e5 + 2;
int n, m, c[nmax];

struct picture
{
    int s, v;
    bool operator < (const picture &other) const
    {
        if (v == other.v) return s > other.s;
        return v > other.v;
    };
} a[nmax];

int main()
{
    if (ifstream(task".inp")) nx
    fast

    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        cin >> a[i].s >> a[i].v;

    for (int i = 1; i <= m; ++i)
        cin >> c[i];

    sort(c + 1, c + m + 1);
    sort(a + 1, a + n + 1);

    int cur_frame = m, ans = 0;
    for (int i = 1; i <= n; ++i)
        if (cur_frame >= 1 && c[cur_frame] >= a[i].s)
            ++ans, --cur_frame;
    
    cout << ans;
}

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:7:20: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | #define nx freopen (task".inp","r",stdin), freopen (task".out","w",stdout);
      |            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:30:31: note: in expansion of macro 'nx'
   30 |     if (ifstream(task".inp")) nx
      |                               ^~
joi2019_ho_t2.cpp:7:52: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | #define nx freopen (task".inp","r",stdin), freopen (task".out","w",stdout);
      |                                            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:30:31: note: in expansion of macro 'nx'
   30 |     if (ifstream(task".inp")) nx
      |                               ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...