답안 #995630

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995630 2024-06-09T13:49:36 Z rsinventor Exhibition (JOI19_ho_t2) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector <string> vs;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef vector <pii> vpii;

#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ins insert
#define endl "\n"

bool cmp(pii a, pii b) {
    if(a.second==b.second) {
        return a.first<b.first;
    }
    return a.second<b.second;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m;
    cin >> n >> m;
    vpii pics(n);
    for(int i = 0; i < n; i++) {
        cin >> pics[i].first >> pics[i].second;
    }
    vi frames(m);
    for(int i = 0; i < m; i++) {
        cin >> frames[i];
    }
    sort(all(frames));
    sort(all(pics), cmp);
    int i = 0;
    int j = 0;
    int ans = 0;
    while(i<pics.size() && j<frames.size()) {
        if(pics[i].first<=frames[j]) {
            i++;
            j++;
            ans++;
        } else {
            j++;
        }
    }
    cout << ans << endl;
    return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:44:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     while(i<pics.size() && j<frames.size()) {
      |           ~^~~~~~~~~~~~
joi2019_ho_t2.cpp:44:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     while(i<pics.size() && j<frames.size()) {
      |                            ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 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 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 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 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -