Submission #99016

# Submission time Handle Problem Language Result Execution time Memory
99016 2019-02-28T05:33:47 Z kriii Exhibition (JOI19_ho_t2) C++17
100 / 100
121 ms 1912 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);
	}
	sort(pic,pic+N);
	reverse(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;
	}
	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:40: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 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 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 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 304 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 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 356 KB Output is correct
17 Correct 2 ms 384 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 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 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 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 304 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 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 356 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 2 ms 304 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 3 ms 256 KB Output is correct
24 Correct 3 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 3 ms 384 KB Output is correct
28 Correct 3 ms 384 KB Output is correct
29 Correct 3 ms 256 KB Output is correct
30 Correct 3 ms 256 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 428 KB Output is correct
33 Correct 2 ms 256 KB Output is correct
34 Correct 3 ms 256 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 3 ms 304 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 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 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 304 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 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 356 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 2 ms 304 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 3 ms 256 KB Output is correct
24 Correct 3 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 3 ms 384 KB Output is correct
28 Correct 3 ms 384 KB Output is correct
29 Correct 3 ms 256 KB Output is correct
30 Correct 3 ms 256 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 428 KB Output is correct
33 Correct 2 ms 256 KB Output is correct
34 Correct 3 ms 256 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 3 ms 304 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
38 Correct 85 ms 1868 KB Output is correct
39 Correct 94 ms 1484 KB Output is correct
40 Correct 63 ms 1472 KB Output is correct
41 Correct 105 ms 1720 KB Output is correct
42 Correct 76 ms 1884 KB Output is correct
43 Correct 85 ms 1884 KB Output is correct
44 Correct 96 ms 1912 KB Output is correct
45 Correct 102 ms 1908 KB Output is correct
46 Correct 83 ms 1528 KB Output is correct
47 Correct 80 ms 1708 KB Output is correct
48 Correct 70 ms 1400 KB Output is correct
49 Correct 66 ms 1472 KB Output is correct
50 Correct 75 ms 1224 KB Output is correct
51 Correct 76 ms 1900 KB Output is correct
52 Correct 93 ms 1904 KB Output is correct
53 Correct 81 ms 1788 KB Output is correct
54 Correct 77 ms 1896 KB Output is correct
55 Correct 93 ms 1440 KB Output is correct
56 Correct 47 ms 1400 KB Output is correct
57 Correct 38 ms 668 KB Output is correct
58 Correct 54 ms 1048 KB Output is correct
59 Correct 70 ms 1452 KB Output is correct
60 Correct 24 ms 640 KB Output is correct
61 Correct 46 ms 916 KB Output is correct
62 Correct 82 ms 1864 KB Output is correct
63 Correct 82 ms 1896 KB Output is correct
64 Correct 106 ms 1896 KB Output is correct
65 Correct 112 ms 1848 KB Output is correct
66 Correct 93 ms 1900 KB Output is correct
67 Correct 81 ms 1844 KB Output is correct
68 Correct 88 ms 1908 KB Output is correct
69 Correct 80 ms 1644 KB Output is correct
70 Correct 81 ms 1532 KB Output is correct
71 Correct 85 ms 1840 KB Output is correct
72 Correct 102 ms 1520 KB Output is correct
73 Correct 121 ms 1520 KB Output is correct