답안 #670306

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
670306 2022-12-08T16:23:59 Z dozer Exhibition (JOI19_ho_t2) C++14
100 / 100
65 ms 8972 KB
#include <bits/stdc++.h>
using namespace std;
#define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define pb push_back
#define pii pair<int, int>
#define st first
#define nd second
#define endl "\n"
#define sp " "
#define N 100005
#define LOGN 17
#define int long long

int v[N], s[N], c[N];
int n, m;
vector<pii> pic;
vector<int> fra;

int check(int x)
{
	int i = 0, j = (m - x);
	while (i < n && j < m)
	{
		int a = pic[i].nd, b = fra[j];
		if (a <= b) i++, j++;
		else i++;
	}
	//cout<<endl;
	if (j == m) return 1;
	return 0;
}

int32_t main()
{
	//fileio();
	fastio();

	cin>>n>>m;
	for (int i = 1; i <= n; i++)
		cin>>s[i]>>v[i];
	for (int i = 1; i <= m; i++)
		cin>>c[i];

	for (int i = 1; i <= n; i++) pic.pb({v[i], s[i]});
	for (int j = 1; j <= m; j++) fra.pb(c[j]);

	sort(pic.begin(), pic.end());
	sort(fra.begin(), fra.end());

	int bound = min(n, m);
	int ans = 0;
	for (int i = LOGN; i >= 0; i--)
	{
		int tmp = ans + (1<<i);
		if (tmp <= bound && check(tmp)) ans = tmp;
	}
	cout<<ans<<endl;

	cerr<<"time taken : "<<(float)clock() / CLOCKS_PER_SEC<<" seconds\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 372 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 1 ms 372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 372 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 1 ms 372 KB Output is correct
38 Correct 52 ms 8900 KB Output is correct
39 Correct 47 ms 8944 KB Output is correct
40 Correct 45 ms 8972 KB Output is correct
41 Correct 51 ms 8900 KB Output is correct
42 Correct 53 ms 8828 KB Output is correct
43 Correct 58 ms 8936 KB Output is correct
44 Correct 50 ms 8920 KB Output is correct
45 Correct 51 ms 8916 KB Output is correct
46 Correct 57 ms 8896 KB Output is correct
47 Correct 44 ms 8116 KB Output is correct
48 Correct 44 ms 8084 KB Output is correct
49 Correct 41 ms 7308 KB Output is correct
50 Correct 44 ms 7416 KB Output is correct
51 Correct 51 ms 8948 KB Output is correct
52 Correct 59 ms 8876 KB Output is correct
53 Correct 49 ms 8828 KB Output is correct
54 Correct 44 ms 8852 KB Output is correct
55 Correct 50 ms 8956 KB Output is correct
56 Correct 38 ms 5964 KB Output is correct
57 Correct 19 ms 3156 KB Output is correct
58 Correct 30 ms 5904 KB Output is correct
59 Correct 34 ms 6004 KB Output is correct
60 Correct 19 ms 3164 KB Output is correct
61 Correct 31 ms 5284 KB Output is correct
62 Correct 57 ms 8912 KB Output is correct
63 Correct 57 ms 8872 KB Output is correct
64 Correct 60 ms 8932 KB Output is correct
65 Correct 57 ms 8892 KB Output is correct
66 Correct 57 ms 8948 KB Output is correct
67 Correct 65 ms 8948 KB Output is correct
68 Correct 58 ms 8944 KB Output is correct
69 Correct 65 ms 8840 KB Output is correct
70 Correct 60 ms 8848 KB Output is correct
71 Correct 65 ms 8948 KB Output is correct
72 Correct 57 ms 8888 KB Output is correct
73 Correct 58 ms 8856 KB Output is correct