Submission #99013

# Submission time Handle Problem Language Result Execution time Memory
99013 2019-02-28T05:31:39 Z 크리(#2856, kriii) Exhibition (JOI19_ho_t2) C++17
100 / 100
126 ms 2040 KB
#include <stdio.h>
#include <algorithm>
using namespace std;

int N,M,C;
pair<int, int> pic[100100];
int sz[100100],bit[100100];

int out(int x)
{
	int r = 0;
	while (x){
		r = max(r,bit[x]);
		x -= x & (-x);
	}
	return r;
}

void in(int x, int p)
{
	while (x <= C){
		bit[x] = max(bit[x],p);
		x += x & (-x);
	}
}

int main()
{
	scanf ("%d %d",&N,&M);
	for (int i=0;i<N;i++){
		scanf ("%d %d",&pic[i].second,&pic[i].first);
		pic[i].first = -pic[i].first;
		pic[i].second = -pic[i].second;
	}
	sort(pic,pic+N);
	for (int i=0;i<N;i++){
		int x = C + 1;
		if (pic[i].first != pic[i+1].first) C++;
		pic[i].first = x;
		pic[i].second = -pic[i].second;
	}
	for (int i=0;i<M;i++) scanf ("%d",&sz[i]);
	sort(sz,sz+M);

	for (int i=0;i<N;i++){
		int u = out(pic[i].first) + 1;
		int v = M - (lower_bound(sz,sz+M,pic[i].second) - sz);
		in(pic[i].first,min(u,v));
	}
	printf ("%d\n",out(C));

	return 0;
}

Compilation message

joi2019_ho_t3.cpp: In function 'int main()':
joi2019_ho_t3.cpp:29:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf ("%d %d",&N,&M);
  ~~~~~~^~~~~~~~~~~~~~~
joi2019_ho_t3.cpp:31:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf ("%d %d",&pic[i].second,&pic[i].first);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t3.cpp:42:30: 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",&sz[i]);
                        ~~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 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 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 3 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 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 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 3 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 3 ms 256 KB Output is correct
25 Correct 0 ms 384 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 4 ms 368 KB Output is correct
28 Correct 3 ms 404 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 3 ms 384 KB Output is correct
33 Correct 2 ms 256 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 3 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 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 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 3 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 3 ms 256 KB Output is correct
25 Correct 0 ms 384 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 4 ms 368 KB Output is correct
28 Correct 3 ms 404 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 3 ms 384 KB Output is correct
33 Correct 2 ms 256 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 3 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
38 Correct 114 ms 1956 KB Output is correct
39 Correct 106 ms 1528 KB Output is correct
40 Correct 58 ms 1400 KB Output is correct
41 Correct 73 ms 1656 KB Output is correct
42 Correct 74 ms 1912 KB Output is correct
43 Correct 108 ms 1860 KB Output is correct
44 Correct 82 ms 1840 KB Output is correct
45 Correct 76 ms 1912 KB Output is correct
46 Correct 75 ms 1528 KB Output is correct
47 Correct 72 ms 1784 KB Output is correct
48 Correct 71 ms 1372 KB Output is correct
49 Correct 68 ms 1528 KB Output is correct
50 Correct 65 ms 1376 KB Output is correct
51 Correct 85 ms 1876 KB Output is correct
52 Correct 78 ms 1916 KB Output is correct
53 Correct 87 ms 1892 KB Output is correct
54 Correct 68 ms 1880 KB Output is correct
55 Correct 77 ms 1528 KB Output is correct
56 Correct 49 ms 1628 KB Output is correct
57 Correct 24 ms 640 KB Output is correct
58 Correct 44 ms 1064 KB Output is correct
59 Correct 55 ms 1500 KB Output is correct
60 Correct 34 ms 632 KB Output is correct
61 Correct 53 ms 1016 KB Output is correct
62 Correct 90 ms 1868 KB Output is correct
63 Correct 95 ms 2040 KB Output is correct
64 Correct 108 ms 1912 KB Output is correct
65 Correct 126 ms 1912 KB Output is correct
66 Correct 101 ms 1840 KB Output is correct
67 Correct 89 ms 1904 KB Output is correct
68 Correct 75 ms 1912 KB Output is correct
69 Correct 89 ms 1648 KB Output is correct
70 Correct 99 ms 1676 KB Output is correct
71 Correct 81 ms 1824 KB Output is correct
72 Correct 79 ms 1512 KB Output is correct
73 Correct 76 ms 1660 KB Output is correct