답안 #995468

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995468 2024-06-09T06:46:40 Z SuPythony Exhibition (JOI19_ho_t2) C++17
0 / 100
0 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int n,m; cin>>n>>m;
    vector<pair<int,int>> a;
    for (int i=0; i<n; i++) {
        int s,v; cin>>s>>v;
        a.push_back({v,s});
    }
    vector<int> c(m);
    for (auto &i: c) cin>>i;
    sort(a.begin(),a.end());
    sort(c.begin(),c.end());
    vector<int> s;
    for (auto i: a) s.push_back(i.second);
    vector<int> lbs;
    for (int i=0; i<n; i++) {
        auto p=lower_bound(c.begin(),c.end(),s[i]);
        if (p==c.end()) continue;
        lbs.push_back(p-c.begin());
    }
    vector<int> l;
    int mn;
    for (int i=0; i<lbs.size(); i++) {
        auto p=upper_bound(l.begin(),l.end(),lbs[i]);
        if (p==l.end()) {
            l.push_back(lbs[i]);
            mn=*min_element(lbs.begin(),lbs.end());
        } else {
            *p=lbs[i];
        }
    }
    cout<<min(m-mn,(int)l.size());
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:26:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for (int i=0; i<lbs.size(); i++) {
      |                   ~^~~~~~~~~~~
joi2019_ho_t2.cpp:35:16: warning: 'mn' may be used uninitialized in this function [-Wmaybe-uninitialized]
   35 |     cout<<min(m-mn,(int)l.size());
      |               ~^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -