답안 #98206

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
98206 2019-02-21T13:59:56 Z scanhex Exhibition (JOI19_ho_t2) C++17
100 / 100
97 ms 2056 KB
#include <bits/stdc++.h>

using namespace std;
using nagai = long long;
#define sz(x) int((x).size())

const int N=100100;
int s[N],v[N],c[N];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	vector<int>ord1(n);
	for(int i=0;i<n;++i)
		cin>>s[i]>>v[i];
	for(int i=0;i<m;++i)cin>>c[i];
	iota(ord1.begin(),ord1.end(),0);
	sort(ord1.begin(),ord1.end(),[&](int a,int b){
			if(v[a]!=v[b])
			return v[a]<v[b];
			return s[a]<s[b];
			});
	sort(c,c+m);
	int ans=0;
	int cur=n-1;
	for(int i=m-1;i>=0;--i){
		while(cur>=0&&s[ord1[cur]]>c[i])--cur;
		if(cur>=0)++ans,--cur;
	}
	cout<<ans<<'\n';
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 356 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 3 ms 432 KB Output is correct
19 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 356 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 3 ms 432 KB Output is correct
19 Correct 0 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 0 ms 384 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 2 ms 512 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 3 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 356 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 3 ms 432 KB Output is correct
19 Correct 0 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 0 ms 384 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 2 ms 512 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 3 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
38 Correct 83 ms 2056 KB Output is correct
39 Correct 68 ms 1912 KB Output is correct
40 Correct 65 ms 1904 KB Output is correct
41 Correct 73 ms 1912 KB Output is correct
42 Correct 75 ms 1912 KB Output is correct
43 Correct 74 ms 1912 KB Output is correct
44 Correct 59 ms 1912 KB Output is correct
45 Correct 64 ms 1964 KB Output is correct
46 Correct 86 ms 1916 KB Output is correct
47 Correct 57 ms 1784 KB Output is correct
48 Correct 56 ms 1784 KB Output is correct
49 Correct 68 ms 1528 KB Output is correct
50 Correct 68 ms 1500 KB Output is correct
51 Correct 59 ms 1912 KB Output is correct
52 Correct 76 ms 1912 KB Output is correct
53 Correct 77 ms 1912 KB Output is correct
54 Correct 73 ms 1912 KB Output is correct
55 Correct 57 ms 1920 KB Output is correct
56 Correct 40 ms 1528 KB Output is correct
57 Correct 26 ms 760 KB Output is correct
58 Correct 42 ms 1528 KB Output is correct
59 Correct 50 ms 1528 KB Output is correct
60 Correct 22 ms 768 KB Output is correct
61 Correct 37 ms 1152 KB Output is correct
62 Correct 65 ms 1912 KB Output is correct
63 Correct 63 ms 1912 KB Output is correct
64 Correct 63 ms 1976 KB Output is correct
65 Correct 84 ms 1912 KB Output is correct
66 Correct 71 ms 1904 KB Output is correct
67 Correct 67 ms 1912 KB Output is correct
68 Correct 73 ms 1912 KB Output is correct
69 Correct 93 ms 1912 KB Output is correct
70 Correct 67 ms 1912 KB Output is correct
71 Correct 79 ms 1884 KB Output is correct
72 Correct 97 ms 1952 KB Output is correct
73 Correct 66 ms 1944 KB Output is correct