Submission #228920

# Submission time Handle Problem Language Result Execution time Memory
228920 2020-05-03T05:49:24 Z PeppaPig Exhibition (JOI19_ho_t2) C++14
0 / 100
5 ms 384 KB
#include <bits/stdc++.h>

#define pii pair<int, int>
#define x first
#define y second

using namespace std;

const int N = 1e5+5;

int n, m, c[N], ptr1, ptr2, ans;
vector<pii> a;

int main() {
    scanf("%d %d" ,&n, &m);
    for(int i = 0, C, v; i < n; i++) {
        scanf("%d %d", &C, &v);
        a.emplace_back(v, C);
    }
    for(int i = 0; i < m; i++) {
        scanf("%d", c + i);
    }
    sort(c+0, c+0+n, greater<int>() );
    sort(a.begin(), a.end(), greater<pii>() );
    while(ptr1 != n-1 && ptr2 != m-1) {
        if(c[ptr2] >= a[ptr1].y) ans++, ptr2++;
        ptr1++;
    }
    printf("%d", ans);

}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d" ,&n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &C, &v);
         ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", c + i);
         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -