답안 #1023673

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1023673 2024-07-15T04:35:55 Z trandangquang Exhibition (JOI19_ho_t2) C++14
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

#define task "test"
#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 sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define bit(s, i) (((s) >> (i)) & 1)
#define ii pair <int, int>
#define vii vector <ii>
#define vi vector <int>
#define fi first
#define se second
#define ll long long
#define eb emplace_back
#define pb push_back
#define __builtin_popcount __builtin_popcountll

void solve();

int32_t main() {
    if(fopen(task".inp", "r")) {
		freopen(task".inp", "r", stdin);
		freopen(task".out", "w", stdout);
	}
	cin.tie(0)->sync_with_stdio(0);

    int tc = 1; // cin >> tc;
    FOR(i, 1, tc) {
        solve();
    }
}

const int N = 100100;

int n, m, frame[N];
ii pic[N];

void solve() {
    cin >> n >> m;
    FOR(i, 1, n) cin >> pic[i].fi >> pic[i].se;
    FOR(i, 1, m) cin >> frame[i];

    sort(pic+1, pic+1+n, [] (ii x, ii y) {return x.se < y.se;});
    sort(frame+1, frame+1+m);

    int pt1 = n, ans = 0;
    FORD(i, m, 1) {
        while(pic[pt1].fi > frame[i]) --pt1;
        if(pt1>0 && pic[pt1].fi <= frame[i]) {
            ++ans;
            --pt1;
        }
    }

    cout << ans;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int32_t main()':
joi2019_ho_t2.cpp:25:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |   freopen(task".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:26:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |   freopen(task".out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -