답안 #564787

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
564787 2022-05-19T16:12:02 Z groshi Exhibition (JOI19_ho_t2) C++17
100 / 100
64 ms 4928 KB
#include<iostream>
#include<utility>
#include<algorithm>
#include<vector>
using namespace std;
vector<int> Q2;
vector<pair<int,int> > Q;
int n;
bool sprawdz(int x)
{
    int gdzie=0;
    for(int i=Q2.size()-x;i<Q2.size();i++)
    {
        while(gdzie<n && Q[gdzie].second>Q2[i])
            gdzie++;
        if(gdzie>=n)
            return 0;
        gdzie++;
    }
    return 1;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int m,x,y;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>x>>y;
        Q.push_back({y,x});
    }
    for(int i=1;i<=m;i++)
    {
        cin>>x;
        Q2.push_back(x);
    }
    sort(Q.begin(),Q.end());
    sort(Q2.begin(),Q2.end());
    int pocz=0,kon=m+1,sre,ostd=0;
    while(pocz<kon)
    {
        sre=(pocz+kon)/2;
        if(sprawdz(sre))
        {
            ostd=sre;
            pocz=sre+1;
        }
        else kon=sre;
    }
    cout<<ostd;
    return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'bool sprawdz(int)':
joi2019_ho_t2.cpp:12:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i=Q2.size()-x;i<Q2.size();i++)
      |                           ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 316 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 316 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 316 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 316 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 360 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 356 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 360 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 328 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 316 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 316 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 360 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 356 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 360 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 328 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 48 ms 4808 KB Output is correct
39 Correct 48 ms 4808 KB Output is correct
40 Correct 44 ms 4856 KB Output is correct
41 Correct 48 ms 4828 KB Output is correct
42 Correct 64 ms 4792 KB Output is correct
43 Correct 49 ms 4804 KB Output is correct
44 Correct 47 ms 4868 KB Output is correct
45 Correct 52 ms 4884 KB Output is correct
46 Correct 49 ms 4864 KB Output is correct
47 Correct 43 ms 4384 KB Output is correct
48 Correct 42 ms 4408 KB Output is correct
49 Correct 43 ms 4060 KB Output is correct
50 Correct 38 ms 4052 KB Output is correct
51 Correct 52 ms 4808 KB Output is correct
52 Correct 51 ms 4928 KB Output is correct
53 Correct 60 ms 4840 KB Output is correct
54 Correct 42 ms 4912 KB Output is correct
55 Correct 46 ms 4808 KB Output is correct
56 Correct 29 ms 3104 KB Output is correct
57 Correct 18 ms 1744 KB Output is correct
58 Correct 28 ms 3124 KB Output is correct
59 Correct 29 ms 3112 KB Output is correct
60 Correct 18 ms 1748 KB Output is correct
61 Correct 29 ms 2764 KB Output is correct
62 Correct 55 ms 4828 KB Output is correct
63 Correct 56 ms 4812 KB Output is correct
64 Correct 54 ms 4812 KB Output is correct
65 Correct 53 ms 4828 KB Output is correct
66 Correct 55 ms 4900 KB Output is correct
67 Correct 51 ms 4880 KB Output is correct
68 Correct 55 ms 4868 KB Output is correct
69 Correct 51 ms 4792 KB Output is correct
70 Correct 49 ms 4892 KB Output is correct
71 Correct 52 ms 4872 KB Output is correct
72 Correct 49 ms 4808 KB Output is correct
73 Correct 53 ms 4908 KB Output is correct