답안 #788256

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
788256 2023-07-20T03:53:42 Z kebine Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 212 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(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;
      |                ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -