답안 #788214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
788214 2023-07-20T01:33:43 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.se < b.se || (a.se == b.se && a.fi < b.fi));
}
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<int> bingkai;
    for(int i = 0; i < m; i++) {
        int x; cin >> x;
        bingkai.pb(x);
    }

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

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:35: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]
   35 |         if(tmp == gambar.size()) break;
      |            ~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -