답안 #171285

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
171285 2019-12-28T07:38:50 Z dennisstar Exhibition (JOI19_ho_t2) C++11
100 / 100
83 ms 5352 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define ryan bear
#define all(V) ((V).begin()), ((V).end())
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef vector<int> vim;
typedef vector<ll> vlm;

int N, M;
int S[100010], V[100010], C[100010];
pii ar[100010];

int main() {
	scanf("%d %d", &N, &M);
	for (int i=0; i<N; i++) {
		scanf("%d %d", &S[i], &V[i]);
		ar[i]={V[i], S[i]};
	}
	for (int i=0; i<M; i++) scanf("%d", &C[i]);
	sort(ar, ar+N);
	sort(C, C+M);
	int ans=0;
	for (int i=M-1, j=N-1; i>=0; i--) {
		for (; j>=0; j--) if (ar[j].se<=C[i]) break;
		if (j>=0) ans++;
		j--;
	}
	printf("%d\n", ans);
	return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:19:7: 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:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &S[i], &V[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:24:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i=0; i<M; i++) scanf("%d", &C[i]);
                          ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 1 ms 248 KB Output is correct
11 Correct 2 ms 252 KB Output is correct
12 Correct 2 ms 380 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 10 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 1 ms 248 KB Output is correct
11 Correct 2 ms 252 KB Output is correct
12 Correct 2 ms 380 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 10 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 3 ms 420 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 380 KB Output is correct
26 Correct 3 ms 376 KB Output is correct
27 Correct 3 ms 376 KB Output is correct
28 Correct 3 ms 376 KB Output is correct
29 Correct 3 ms 376 KB Output is correct
30 Correct 3 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 3 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 3 ms 376 KB Output is correct
35 Correct 3 ms 376 KB Output is correct
36 Correct 3 ms 380 KB Output is correct
37 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 1 ms 248 KB Output is correct
11 Correct 2 ms 252 KB Output is correct
12 Correct 2 ms 380 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 10 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 3 ms 420 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 380 KB Output is correct
26 Correct 3 ms 376 KB Output is correct
27 Correct 3 ms 376 KB Output is correct
28 Correct 3 ms 376 KB Output is correct
29 Correct 3 ms 376 KB Output is correct
30 Correct 3 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 3 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 3 ms 376 KB Output is correct
35 Correct 3 ms 376 KB Output is correct
36 Correct 3 ms 380 KB Output is correct
37 Correct 3 ms 376 KB Output is correct
38 Correct 77 ms 5132 KB Output is correct
39 Correct 72 ms 5112 KB Output is correct
40 Correct 63 ms 5112 KB Output is correct
41 Correct 79 ms 5288 KB Output is correct
42 Correct 75 ms 5112 KB Output is correct
43 Correct 75 ms 5236 KB Output is correct
44 Correct 76 ms 5112 KB Output is correct
45 Correct 79 ms 5112 KB Output is correct
46 Correct 71 ms 5220 KB Output is correct
47 Correct 68 ms 4828 KB Output is correct
48 Correct 70 ms 4824 KB Output is correct
49 Correct 62 ms 4088 KB Output is correct
50 Correct 65 ms 4216 KB Output is correct
51 Correct 72 ms 5196 KB Output is correct
52 Correct 79 ms 5224 KB Output is correct
53 Correct 78 ms 5232 KB Output is correct
54 Correct 60 ms 5240 KB Output is correct
55 Correct 71 ms 5288 KB Output is correct
56 Correct 49 ms 3696 KB Output is correct
57 Correct 30 ms 1656 KB Output is correct
58 Correct 41 ms 3960 KB Output is correct
59 Correct 50 ms 3832 KB Output is correct
60 Correct 30 ms 1656 KB Output is correct
61 Correct 46 ms 2936 KB Output is correct
62 Correct 83 ms 5244 KB Output is correct
63 Correct 74 ms 5244 KB Output is correct
64 Correct 79 ms 5160 KB Output is correct
65 Correct 73 ms 5120 KB Output is correct
66 Correct 80 ms 5240 KB Output is correct
67 Correct 70 ms 5224 KB Output is correct
68 Correct 76 ms 5224 KB Output is correct
69 Correct 80 ms 5112 KB Output is correct
70 Correct 83 ms 5352 KB Output is correct
71 Correct 79 ms 5216 KB Output is correct
72 Correct 78 ms 5340 KB Output is correct
73 Correct 72 ms 5296 KB Output is correct