답안 #786136

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
786136 2023-07-18T04:29:32 Z andecaandeci Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
struct ds{
    int si,value;
};
bool comp(ds p1, ds p2) {
    return p1.value > p2.value;
}
int hitung(vector<ds>& v, vector<int>& pi) {
    sort(v.begin(), v.end(), comp);
    int tot = 0;
    int i = 0;
    for (int j = 0; j < pi.size() && i < v.size(); j++) {
        if(pi[j] >= v[i].si) {
            tot++;
            i++;
        }
    }
    return tot;
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<ds> v(N);
    for (int i = 0; i < N; i++) {
        cin >> v[i].si >>v[i].value;
    }
    vector<int> pi(M);
    for (int i = 0; i < M; i++) {
        cin >> pi[i];
    }
    int result = hitung(v, pi);
    cout << result << endl;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int hitung(std::vector<ds>&, std::vector<int>&)':
joi2019_ho_t2.cpp:15:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int j = 0; j < pi.size() && i < v.size(); j++) {
      |                     ~~^~~~~~~~~~~
joi2019_ho_t2.cpp:15:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<ds>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int j = 0; j < pi.size() && i < v.size(); j++) {
      |                                      ~~^~~~~~~~~~
# 결과 실행 시간 메모리 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 -