Submission #99014

# Submission time Handle Problem Language Result Execution time Memory
99014 2019-02-28T05:31:59 Z kriii Exhibition (JOI19_ho_t2) C++17
100 / 100
119 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);
		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 384 KB Output is correct
3 Correct 2 ms 384 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 3 ms 384 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 284 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 256 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 284 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 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 384 KB Output is correct
3 Correct 2 ms 384 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 3 ms 384 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 284 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 256 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 284 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 256 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 3 ms 256 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 3 ms 404 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 3 ms 256 KB Output is correct
29 Correct 3 ms 364 KB Output is correct
30 Correct 3 ms 256 KB Output is correct
31 Correct 4 ms 256 KB Output is correct
32 Correct 2 ms 256 KB Output is correct
33 Correct 2 ms 256 KB Output is correct
34 Correct 2 ms 256 KB Output is correct
35 Correct 3 ms 256 KB Output is correct
36 Correct 3 ms 384 KB Output is correct
37 Correct 2 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 384 KB Output is correct
3 Correct 2 ms 384 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 3 ms 384 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 284 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 256 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 284 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 256 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 3 ms 256 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 3 ms 404 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 3 ms 256 KB Output is correct
29 Correct 3 ms 364 KB Output is correct
30 Correct 3 ms 256 KB Output is correct
31 Correct 4 ms 256 KB Output is correct
32 Correct 2 ms 256 KB Output is correct
33 Correct 2 ms 256 KB Output is correct
34 Correct 2 ms 256 KB Output is correct
35 Correct 3 ms 256 KB Output is correct
36 Correct 3 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 104 ms 1900 KB Output is correct
39 Correct 95 ms 1400 KB Output is correct
40 Correct 84 ms 1424 KB Output is correct
41 Correct 94 ms 1656 KB Output is correct
42 Correct 85 ms 1784 KB Output is correct
43 Correct 79 ms 1892 KB Output is correct
44 Correct 84 ms 1784 KB Output is correct
45 Correct 84 ms 1900 KB Output is correct
46 Correct 72 ms 1548 KB Output is correct
47 Correct 112 ms 1816 KB Output is correct
48 Correct 71 ms 1528 KB Output is correct
49 Correct 72 ms 1528 KB Output is correct
50 Correct 60 ms 1208 KB Output is correct
51 Correct 76 ms 1820 KB Output is correct
52 Correct 102 ms 1896 KB Output is correct
53 Correct 74 ms 1892 KB Output is correct
54 Correct 64 ms 1784 KB Output is correct
55 Correct 85 ms 1512 KB Output is correct
56 Correct 42 ms 1528 KB Output is correct
57 Correct 38 ms 640 KB Output is correct
58 Correct 39 ms 1024 KB Output is correct
59 Correct 56 ms 1400 KB Output is correct
60 Correct 33 ms 640 KB Output is correct
61 Correct 47 ms 1016 KB Output is correct
62 Correct 114 ms 1912 KB Output is correct
63 Correct 88 ms 1912 KB Output is correct
64 Correct 86 ms 1784 KB Output is correct
65 Correct 119 ms 1784 KB Output is correct
66 Correct 101 ms 1912 KB Output is correct
67 Correct 79 ms 1912 KB Output is correct
68 Correct 86 ms 1784 KB Output is correct
69 Correct 82 ms 1656 KB Output is correct
70 Correct 89 ms 1528 KB Output is correct
71 Correct 90 ms 1864 KB Output is correct
72 Correct 80 ms 1400 KB Output is correct
73 Correct 75 ms 1576 KB Output is correct