Submission #788260

# Submission time Handle Problem Language Result Execution time Memory
788260 2023-07-20T03:56:50 Z devariaota Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 324 KB
#include <bits/stdc++.h>
using namespace std;
 
#define v          vector
#define int        long long
#define all(a)     (a).begin(), (a).end()
#define pb         push_back
#define mk         make_pair
#define pii        pair<int, int>
#define ff         first
#define ss         second
#define inp_v(vec) for (auto &i : vec) cin >> i;
#define prt_v(vec) for (auto i : vec) cout << i << endl;
#define MS(x)     memset(x, 0, sizeof(x))
#define gcd(a,b)   __gcd(a, b);
#define lcm(a,b)   (a*(b/gcd(a,b)))
#define lb         lower_bound
#define ub         upper_bound
bool chmin(int &a, int b){return b<a?a=b, true:false;}
bool chmax(int &a, int b){return b>a?a=b, true:false;}
 const int mod=1e9+7;
 const int h=1000000000;
bool comp(const pair<int, int>&a, const pair<int, int>&b){
    if(a.second==b.second)return a.first<b.first;
    return a.second>b.second;
}
signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
    int N, M;cin>>N>>M;
    vector<pair<int, int>>A(N);
    vector<int>B(M);
    for(int i=0;i<N;i++){
        cin>>A[i].first>>A[i].second;
    }
    for(auto &i:B)cin>>i;
    sort(B.begin(), B.end(), greater<int>());
    sort(A.begin(), A.end(), comp);
    int idx=0, ans=0;
    for(auto i:A){
        if(idx<M&&i.first<=B[idx]){
            idx++;
            // cout<<i.first<<" "<<B[idx]<<endl;
        }
    }
    cout<<idx<<endl;

    return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:38:16: warning: unused variable 'ans' [-Wunused-variable]
   38 |     int idx=0, ans=0;
      |                ^~~
# 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 Incorrect 1 ms 324 KB Output isn't correct
4 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 Incorrect 1 ms 324 KB Output isn't correct
4 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 Incorrect 1 ms 324 KB Output isn't correct
4 Halted 0 ms 0 KB -