Submission #126515

# Submission time Handle Problem Language Result Execution time Memory
126515 2019-07-08T02:48:35 Z tri Exhibition (JOI19_ho_t2) C++14
100 / 100
288 ms 5148 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;

#define pb push_back
#define f first
#define s second

int main() {
    int N, M;
    cin >> N >> M;
    vector<pi> pictures;
    for (int i = 0; i < N; i++) {
        int s, v;
        cin >> s >> v;
        pictures.pb({v, s});
    }

    vi frames;
    for (int i = 0; i < M; i++) {
        int s;
        cin >> s;
        frames.pb(s);
    }

    sort(pictures.begin(), pictures.end());
    sort(frames.begin(), frames.end());

    reverse(pictures.begin(), pictures.end());
    reverse(frames.begin(), frames.end());

    int nP = 0, ans = 0;
    for (int i = 0; i < frames.size(); i++) {
        while (nP < pictures.size() && pictures[nP].s > frames[i]) {
            nP++;
        }
        if (nP == pictures.size()) {
            break;
        }
        ans++;
        nP++;
    }
    cout << ans << endl;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:41:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < frames.size(); i++) {
                     ~~^~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:42:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while (nP < pictures.size() && pictures[nP].s > frames[i]) {
                ~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:45:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (nP == pictures.size()) {
             ~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 252 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 252 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 380 KB Output is correct
20 Correct 4 ms 376 KB Output is correct
21 Correct 4 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 4 ms 376 KB Output is correct
24 Correct 4 ms 404 KB Output is correct
25 Correct 4 ms 376 KB Output is correct
26 Correct 4 ms 504 KB Output is correct
27 Correct 4 ms 380 KB Output is correct
28 Correct 4 ms 376 KB Output is correct
29 Correct 4 ms 376 KB Output is correct
30 Correct 4 ms 376 KB Output is correct
31 Correct 4 ms 376 KB Output is correct
32 Correct 3 ms 380 KB Output is correct
33 Correct 3 ms 376 KB Output is correct
34 Correct 4 ms 376 KB Output is correct
35 Correct 3 ms 376 KB Output is correct
36 Correct 4 ms 376 KB Output is correct
37 Correct 4 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 252 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 380 KB Output is correct
20 Correct 4 ms 376 KB Output is correct
21 Correct 4 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 4 ms 376 KB Output is correct
24 Correct 4 ms 404 KB Output is correct
25 Correct 4 ms 376 KB Output is correct
26 Correct 4 ms 504 KB Output is correct
27 Correct 4 ms 380 KB Output is correct
28 Correct 4 ms 376 KB Output is correct
29 Correct 4 ms 376 KB Output is correct
30 Correct 4 ms 376 KB Output is correct
31 Correct 4 ms 376 KB Output is correct
32 Correct 3 ms 380 KB Output is correct
33 Correct 3 ms 376 KB Output is correct
34 Correct 4 ms 376 KB Output is correct
35 Correct 3 ms 376 KB Output is correct
36 Correct 4 ms 376 KB Output is correct
37 Correct 4 ms 376 KB Output is correct
38 Correct 241 ms 5076 KB Output is correct
39 Correct 237 ms 4844 KB Output is correct
40 Correct 236 ms 4984 KB Output is correct
41 Correct 239 ms 4984 KB Output is correct
42 Correct 243 ms 5024 KB Output is correct
43 Correct 240 ms 4972 KB Output is correct
44 Correct 240 ms 4976 KB Output is correct
45 Correct 238 ms 4932 KB Output is correct
46 Correct 235 ms 4848 KB Output is correct
47 Correct 213 ms 4584 KB Output is correct
48 Correct 214 ms 4496 KB Output is correct
49 Correct 210 ms 4036 KB Output is correct
50 Correct 198 ms 4132 KB Output is correct
51 Correct 244 ms 5148 KB Output is correct
52 Correct 239 ms 4944 KB Output is correct
53 Correct 245 ms 4800 KB Output is correct
54 Correct 236 ms 5032 KB Output is correct
55 Correct 241 ms 4940 KB Output is correct
56 Correct 157 ms 3180 KB Output is correct
57 Correct 83 ms 1780 KB Output is correct
58 Correct 157 ms 3276 KB Output is correct
59 Correct 158 ms 3240 KB Output is correct
60 Correct 84 ms 1880 KB Output is correct
61 Correct 138 ms 2872 KB Output is correct
62 Correct 288 ms 4964 KB Output is correct
63 Correct 239 ms 4972 KB Output is correct
64 Correct 239 ms 4972 KB Output is correct
65 Correct 239 ms 5100 KB Output is correct
66 Correct 238 ms 4988 KB Output is correct
67 Correct 238 ms 4844 KB Output is correct
68 Correct 240 ms 4972 KB Output is correct
69 Correct 239 ms 5072 KB Output is correct
70 Correct 241 ms 4960 KB Output is correct
71 Correct 238 ms 4968 KB Output is correct
72 Correct 250 ms 4968 KB Output is correct
73 Correct 240 ms 5020 KB Output is correct