Submission #117707

# Submission time Handle Problem Language Result Execution time Memory
117707 2019-06-17T06:53:05 Z JohnTitor Exhibition (JOI19_ho_t2) C++11
100 / 100
49 ms 4724 KB
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=(j); i<=(k); i++)
#define FFOR(i, j, k) for(int i=(j); i<(k); i++)
#define DFOR(i, j, k) for(int i=(j); i>=(k); i--)
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'
#define pb push_back
#define mp make_pair
#define bit(s, i) (((s)>>(i))&1LL)
#define mask(i) ((1LL<<(i)))
#define builtin_popcount __builtin_popcountll
#define __builtin_popcount __builtin_popcountll
using ll=long long; using ld=long double;
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); const ld pi=acos(0)*2;
template <typename T> inline void read(T &x){char c; bool nega=0; while((!isdigit(c=getchar()))&&(c!='-')); if(c=='-'){nega=1; c=getchar();} x=c-48; while(isdigit(c=getchar())) x=x*10+c-48; if(nega) x=-x;}
template <typename T> inline void writep(T x){if(x>9) writep(x/10); putchar(x%10+48);}
template <typename T> inline void write(T x){if(x<0){ putchar('-'); x=-x;} writep(x);}
template <typename T> inline void writeln(T x){write(x); putchar('\n');}
#define taskname "Exhibition"
int n, m;
class picture{
public:
    int s, v;
    void input(){
        read(s);
        read(v);
    }
};
deque <picture> q;
deque <int> c;
int main(){
    #ifdef Aria
        if(fopen(taskname".in", "r"))
            freopen(taskname".in", "r", stdin);
    #endif // Aria
    read(n);
    read(m);
    q.resize(n);
    c.resize(m);
    for(auto &x: q) x.input();
    for(auto &x: c) read(x);
    sort(c.begin(), c.end());
    reverse(c.begin(), c.end());
    sort(q.begin(), q.end(), [](picture A, picture B){
        return (A.v>B.v)||(A.v==B.v&&A.s>B.s);
    });
    int ans=0;
    while(!(c.empty()||q.empty())){
        if(q.front().s>c.front()) q.pop_front();
        else{
            ans++;
            c.pop_front();
            q.pop_front();
        }
    }
    writeln(ans);
}
# 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 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 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 384 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 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 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 256 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 384 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 384 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 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 356 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 512 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 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 2 ms 408 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 256 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 384 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 384 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 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 356 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 512 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 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 2 ms 408 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 49 ms 4472 KB Output is correct
39 Correct 40 ms 4472 KB Output is correct
40 Correct 37 ms 4476 KB Output is correct
41 Correct 44 ms 4404 KB Output is correct
42 Correct 43 ms 4472 KB Output is correct
43 Correct 45 ms 4404 KB Output is correct
44 Correct 46 ms 4600 KB Output is correct
45 Correct 48 ms 4472 KB Output is correct
46 Correct 42 ms 4472 KB Output is correct
47 Correct 40 ms 3960 KB Output is correct
48 Correct 39 ms 3968 KB Output is correct
49 Correct 38 ms 3576 KB Output is correct
50 Correct 34 ms 3584 KB Output is correct
51 Correct 45 ms 4524 KB Output is correct
52 Correct 44 ms 4472 KB Output is correct
53 Correct 45 ms 4572 KB Output is correct
54 Correct 43 ms 4472 KB Output is correct
55 Correct 45 ms 4472 KB Output is correct
56 Correct 30 ms 3072 KB Output is correct
57 Correct 19 ms 1792 KB Output is correct
58 Correct 28 ms 3072 KB Output is correct
59 Correct 30 ms 3064 KB Output is correct
60 Correct 20 ms 1792 KB Output is correct
61 Correct 29 ms 2688 KB Output is correct
62 Correct 48 ms 4472 KB Output is correct
63 Correct 47 ms 4480 KB Output is correct
64 Correct 47 ms 4476 KB Output is correct
65 Correct 46 ms 4480 KB Output is correct
66 Correct 49 ms 4472 KB Output is correct
67 Correct 47 ms 4532 KB Output is correct
68 Correct 46 ms 4480 KB Output is correct
69 Correct 46 ms 4476 KB Output is correct
70 Correct 49 ms 4460 KB Output is correct
71 Correct 49 ms 4724 KB Output is correct
72 Correct 46 ms 4472 KB Output is correct
73 Correct 43 ms 4472 KB Output is correct