Submission #369338

# Submission time Handle Problem Language Result Execution time Memory
369338 2021-02-21T10:56:42 Z parsabahrami Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 364 KB
// Call my Name and Save me from The Dark
#include <bits/stdc++.h>
 
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
 
#define SZ(x)                       (int) x.size()
#define F                           first
#define S                           second

const int N = 1e5 + 10, MOD = 1e9 + 7;
int ret, n, m, S[N], V[N], id[N], C[N];

int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf("%d%d", &S[i], &V[i]), id[i] = i;
    }
    sort(id + 1, id + n + 1, [&] (int i, int j) { return V[i] < V[j]; });
    for (int i = 1; i <= m; i++) 
        scanf("%d", &C[i]);
    sort(C + 1, C + m + 1);
    for (int i = m, ptr = n; i >= 1; i--) {
        if (ptr <= 0) break;
        while (S[id[ptr]] > C[i]) ptr--;
        if (ptr && S[id[ptr--]] <= C[i]) ret++;
    }
    printf("%d\n", ret);
    return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |         scanf("%d%d", &S[i], &V[i]), id[i] = i;
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |         scanf("%d", &C[i]);
      |         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -