Submission #788212

# Submission time Handle Problem Language Result Execution time Memory
788212 2023-07-20T01:27:23 Z makanhulia Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 212 KB
#include<bits/stdc++.h>
using namespace std;
#define ioss ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define pii pair<int, int>
#define fi first
#define se second
#define pb push_back
int n, m;
vector<pii> gambar;
bool comp(pii a, pii b) {
    return (a.fi < b.fi || (a.fi == b.fi && a.se < b.se));
}
signed main() {
    ioss;
    cin >> n >> m;
    for(int i = 0; i < n; i++) {
        int s, v; cin >> s >> v;
        gambar.pb({s, v});
    }
    sort(gambar.begin(), gambar.end(), comp);
    vector<pii> img;
    img.pb({gambar[0].fi, gambar[0].se});
    for(int i = 1; i < n; i++) {
        auto [s, v] = gambar[i];
        auto [ps, pv] = gambar[i-1];
        if(pv > v) continue;
        img.pb({s, v});
    }
    vector<int> bingkai;
    for(int i = 0; i < m; i++) {
        int x; cin >> x;
        bingkai.pb(x);
    }

    int tmp = 0, ans = 0;
    for(auto size : bingkai) {
        auto [s, v] = img[tmp];
        if(s <= size) ans++, tmp++;
        if(tmp == img.size()) break;
        // cout << " :: " << s << " " << size << " " << ans << endl;
    }
    cout << ans << endl;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:40:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         if(tmp == img.size()) break;
      |            ~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -