제출 #553278

#제출 시각아이디문제언어결과실행 시간메모리
553278sandry24Exhibition (JOI19_ho_t2)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define pb push_back
#define mp make_pair
#define f first
#define s second

void solve(){
    ll n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> pict(n);
    vector<ll> frames(m);
    for(int i = 0; i < n; i++)
        cin >> pict[i].f >> pict[i].s;
    for(int i = 0; i < m; i++)
        cin >> frames[i];
    sort(frames.begin(), frames.end());
    sort(pict.begin(), pict.end());
    multiset<ll> lot;
    int j = 0;
    ll last = -1;
    ll occurences = 0;
    ll ans = 0, current = 0;
    for(int i = 0; i < m; i++){
        while(pict[j].f <= frames[i]){
            lot.insert(pict[j].s);
            j++;
        }
        if(lot.size() == 0)
            continue;
        //cout << lot.size() << '\n';
        ll lb = last;
        if(occurences > lot.count(lb) && lb != -1)
            lb++;
        //cout << lb << ' ';
        auto h = lot.lower_bound(lb);
        if(h == lot.end()){
            ans = max(current, ans);
            last = -1;
            h = lot.lower_bound(last);
            current = 0;
        }
        if(*h == lb)
            occurences++;
        else
            occurences = 1;
        last = *h;
        //cout << lb << ' ' << last << '\n';
        current++;
    }
    ans = max(current, ans);
    cout << ans << '\n';
}

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

컴파일 시 표준 에러 (stderr) 메시지

joi2019_ho_t2.cpp: In function 'void solve()':
joi2019_ho_t2.cpp:37:23: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         if(occurences > lot.count(lb) && lb != -1)
      |            ~~~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...