Submission #478561

# Submission time Handle Problem Language Result Execution time Memory
478561 2021-10-08T01:47:54 Z Mackerel_Pike Exhibition (JOI19_ho_t2) C++14
100 / 100
65 ms 1492 KB
#include <bits/stdc++.h>

using namespace std;

#define fst first
#define snd second

const int maxn = 1e5 + 5;

int n, m;
int c[maxn];
pair<int, int> a[maxn];

int main(){
  //freopen("a.in", "r", stdin);
  //freopen("a.out", "w", stdout);
  
  scanf("%d%d", &n, &m);
  for(int i = 0; i < n; ++i)
    scanf("%d%d", &a[i].snd, &a[i].fst);
  for(int i = 0; i < m; ++i)
    scanf("%d", c + i);

  sort(a, a + n);
  sort(c, c + m);

  int ans = 0;
  for(int i = m - 1, j = n - 1; i >= 0; --i){
    for(; j >= 0 && a[j].snd > c[i]; --j);
    if(j < 0)
      break;
    else
      ++ans, --j;
  }

  printf("%d\n", ans);
  return 0;
}
  

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf("%d%d", &n, &m);
      |   ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     scanf("%d%d", &a[i].snd, &a[i].fst);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scanf("%d", c + i);
      |     ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 236 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 236 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Correct 49 ms 1408 KB Output is correct
39 Correct 47 ms 1408 KB Output is correct
40 Correct 49 ms 1332 KB Output is correct
41 Correct 51 ms 1348 KB Output is correct
42 Correct 65 ms 1448 KB Output is correct
43 Correct 48 ms 1424 KB Output is correct
44 Correct 49 ms 1448 KB Output is correct
45 Correct 50 ms 1352 KB Output is correct
46 Correct 49 ms 1432 KB Output is correct
47 Correct 43 ms 1220 KB Output is correct
48 Correct 42 ms 1276 KB Output is correct
49 Correct 41 ms 1228 KB Output is correct
50 Correct 39 ms 1316 KB Output is correct
51 Correct 47 ms 1348 KB Output is correct
52 Correct 48 ms 1348 KB Output is correct
53 Correct 50 ms 1376 KB Output is correct
54 Correct 42 ms 1356 KB Output is correct
55 Correct 53 ms 1344 KB Output is correct
56 Correct 38 ms 1076 KB Output is correct
57 Correct 19 ms 632 KB Output is correct
58 Correct 29 ms 984 KB Output is correct
59 Correct 32 ms 980 KB Output is correct
60 Correct 20 ms 688 KB Output is correct
61 Correct 30 ms 956 KB Output is correct
62 Correct 50 ms 1416 KB Output is correct
63 Correct 50 ms 1448 KB Output is correct
64 Correct 52 ms 1448 KB Output is correct
65 Correct 53 ms 1356 KB Output is correct
66 Correct 49 ms 1348 KB Output is correct
67 Correct 56 ms 1492 KB Output is correct
68 Correct 52 ms 1396 KB Output is correct
69 Correct 51 ms 1412 KB Output is correct
70 Correct 54 ms 1424 KB Output is correct
71 Correct 48 ms 1444 KB Output is correct
72 Correct 49 ms 1348 KB Output is correct
73 Correct 45 ms 1368 KB Output is correct