Submission #99670

# Submission time Handle Problem Language Result Execution time Memory
99670 2019-03-06T05:05:01 Z cki86201 Exhibition (JOI19_ho_t2) C++11
100 / 100
153 ms 1656 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <bitset>
#include <time.h>
#include <limits.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
typedef tuple<int, int, int> t3;

int N, M;
pii p[100010];
int C[100010];
int X[100010];

int main() {
	scanf("%d%d", &N, &M);
	for(int i=1;i<=N;i++) {
		scanf("%d%d", &p[i].Se, &p[i].Fi);
	}
	sort(p+1, p+1+N);
	for(int i=1;i<=M;i++) scanf("%d", C + i);
	sort(C+1, C+1+M); reverse(C+1, C+1+M);
	int low = 0, high = min(N, M), res = -1;
	while(low <= high) {
		int mid = (low + high) >> 1;
		int z = 0;
		for(int i=1;i<=N;i++) {
			int val = p[i].Se;
			int t = (int)(upper_bound(X+1, X+1+z, val) - X);
			if(C[mid+1-t] < val) continue;
			if(t == 1+z) ++z;
			if(z == mid) break;
		}
		if(z >= mid) res = mid, low = mid + 1;
		else high = mid - 1;
	}
	printf("%d\n", res);
	return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:38:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &M);
  ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:40:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &p[i].Se, &p[i].Fi);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:43:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=M;i++) scanf("%d", C + i);
                        ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 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 2 ms 256 KB Output is correct
6 Correct 2 ms 384 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 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 3 ms 384 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 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 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 2 ms 256 KB Output is correct
6 Correct 2 ms 384 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 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 3 ms 384 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 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 3 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 4 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 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 4 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 4 ms 384 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 2 ms 384 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 256 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 2 ms 256 KB Output is correct
6 Correct 2 ms 384 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 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 3 ms 384 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 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 3 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 4 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 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 4 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 4 ms 384 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 3 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
38 Correct 153 ms 1540 KB Output is correct
39 Correct 113 ms 1528 KB Output is correct
40 Correct 111 ms 1528 KB Output is correct
41 Correct 112 ms 1500 KB Output is correct
42 Correct 72 ms 1528 KB Output is correct
43 Correct 75 ms 1528 KB Output is correct
44 Correct 89 ms 1528 KB Output is correct
45 Correct 116 ms 1608 KB Output is correct
46 Correct 113 ms 1528 KB Output is correct
47 Correct 117 ms 1412 KB Output is correct
48 Correct 91 ms 1400 KB Output is correct
49 Correct 83 ms 1372 KB Output is correct
50 Correct 82 ms 1272 KB Output is correct
51 Correct 68 ms 1440 KB Output is correct
52 Correct 71 ms 1528 KB Output is correct
53 Correct 82 ms 1512 KB Output is correct
54 Correct 93 ms 1528 KB Output is correct
55 Correct 115 ms 1656 KB Output is correct
56 Correct 38 ms 1144 KB Output is correct
57 Correct 26 ms 640 KB Output is correct
58 Correct 41 ms 1144 KB Output is correct
59 Correct 42 ms 1144 KB Output is correct
60 Correct 26 ms 768 KB Output is correct
61 Correct 70 ms 1012 KB Output is correct
62 Correct 117 ms 1528 KB Output is correct
63 Correct 116 ms 1552 KB Output is correct
64 Correct 123 ms 1480 KB Output is correct
65 Correct 118 ms 1532 KB Output is correct
66 Correct 130 ms 1528 KB Output is correct
67 Correct 119 ms 1524 KB Output is correct
68 Correct 129 ms 1540 KB Output is correct
69 Correct 138 ms 1528 KB Output is correct
70 Correct 129 ms 1528 KB Output is correct
71 Correct 127 ms 1532 KB Output is correct
72 Correct 116 ms 1528 KB Output is correct
73 Correct 146 ms 1424 KB Output is correct