結果

問題 No.580 旅館の予約計画
ユーザー cureskolcureskol
提出日時 2021-03-16 12:28:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 588 bytes
コンパイル時間 1,796 ms
コンパイル使用メモリ 172,672 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 11:34:24
合計ジャッジ時間 2,875 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 3 ms
5,376 KB
testcase_25 AC 3 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 3 ms
5,376 KB
testcase_31 AC 3 ms
5,376 KB
testcase_32 AC 3 ms
5,376 KB
testcase_33 AC 3 ms
5,376 KB
testcase_34 AC 3 ms
5,376 KB
testcase_35 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()

typedef pair<int,int> P;

signed main(){
  int n,m;cin>>n>>m;
  vector<P> v(m);
  REP(i,m){
    int d,h,mi;char c;
    cin>>d>>h>>c>>mi;
    v[i].second=(d*24+h)*60+mi;
    cin>>d>>h>>c>>mi;
    v[i].first=(d*24+h)*60+mi;
  }
  sort(ALL(v));
  multiset<int> s;
  REP(i,n)s.insert(0);
  int ans=0;
  REP(i,m){
    int en=v[i].first,be=v[i].second;
    if(*s.begin()>=be)continue;
    s.erase(--s.lower_bound(be));
    s.insert(en);
    ans++;
  }
  cout<<ans<<endl;
}
0