Submission #755291

# Submission time Handle Problem Language Result Execution time Memory
755291 2023-06-09T17:25:20 Z Charizard2021 Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 212 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, m;
    cin >> n >> m;
    vector<pair<int, int> > pictures(n);
    //value = first, size = second
    for(int i = 0; i < n; i++){
        cin >> pictures[i].second >> pictures[i].first;
    }
    vector<int> frames(m);
    for(int i = 0; i < m; i++){
        cin >> frames[i];
    }
    sort(pictures.begin(), pictures.end());
    sort(frames.begin(), frames.end());
    int current_idx = -1;
    int ans = 0;
    for(int i = 0; i < n; i++){
        int low = current_idx;
        int high = m - 1;
        int ans2 = -1;
        while(low <= high){
            int mid = (low + high)/2;
            if(pictures[i].second <= frames[mid]){
                high = mid - 1;
                ans2 = mid;
            }
            else{
                low = mid + 1;
            }
        }
        // cout << i << " " << low << "\n";
        if(low != current_idx){
            current_idx = low;
            ans++;
        }
    }
    cout << ans << "\n";
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:22:13: warning: variable 'ans2' set but not used [-Wunused-but-set-variable]
   22 |         int ans2 = -1;
      |             ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -