Submission #670453

# Submission time Handle Problem Language Result Execution time Memory
670453 2022-12-09T07:09:27 Z berr Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long


signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m; cin>>n>>m;


    vector<int> c(m);
    vector<array<int, 2>> a(n);


    for(int i = 0; i < n; i++){
        cin >> a[i][0] >> a[i][1];
    }

    for(int i = 0; i < m; i++){
        cin>>c[i];
    }


    sort(a.begin(), a.end());
    sort(c.begin(), c.end());


    int s=0;

    for(int i=20; i>=0; i--){
        int tmp= s + (1<<i);

        if(tmp<=m){
            vector<array<int, 2>> t(tmp);

            for(int i=0; i<tmp; i++){
                t[i]=a[i]; swap(t[i][0], t[i][1]);
            }

            sort(t.begin(), t.end());

            int flag=1;

            int l=0;
            for(int i=m-tmp; i<m; i++)
            {   
                
                if(t[l][1]>c[i]) flag=0; l++;
            }


            if(flag) s=tmp;
        }
    }


    cout<<s;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:49:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   49 |                 if(t[l][1]>c[i]) flag=0; l++;
      |                 ^~
joi2019_ho_t2.cpp:49:42: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   49 |                 if(t[l][1]>c[i]) flag=0; l++;
      |                                          ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Incorrect 0 ms 212 KB Output isn't correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Incorrect 0 ms 212 KB Output isn't correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Incorrect 0 ms 212 KB Output isn't correct
14 Halted 0 ms 0 KB -