結果

問題 No.580 旅館の予約計画
ユーザー aaaaaaiu
提出日時 2019-08-29 23:26:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 2,286 ms
コンパイル使用メモリ 201,924 KB
最終ジャッジ日時 2025-01-07 15:37:37
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int n,m;
    cin>>n>>m;
    pair<int,int> a[m];
    for (int i=0;i<m;i++) {
        int b,c,d,e,f,g;
        cin>>b>>c>>d>>e>>f>>g;
        a[i]={24*60*e+60*f+g,24*60*b+60*c+d};
    }
    sort(a,a+m);
    multiset<int> ms;
    for (int i=0;i<n;i++)
        ms.insert(-1);
    int ans=0;
    for (auto p:a) {
        auto it=ms.lower_bound(p.second);
        if (it!=ms.begin()) {
            it--;
            ms.erase(it);
            ms.insert(p.first);
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}
0