結果
問題 |
No.580 旅館の予約計画
|
ユーザー |
![]() |
提出日時 | 2020-04-04 19:01:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 1,220 bytes |
コンパイル時間 | 2,585 ms |
コンパイル使用メモリ | 203,856 KB |
最終ジャッジ日時 | 2025-01-09 14:06:52 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
#include<bits/stdc++.h> #define ALL(v) std::begin(v),std::end(v) using lint=long long; using lubl=long double; template<class Begin,class End> struct span{ using value_type=typename Begin::value_type; Begin begin_; End end_; span(Begin begin__, End end__):begin_(begin__),end_(end__){} auto begin(){return begin_;} auto end(){return end_;} auto begin()const{return begin_;} auto end()const{return end_;} }; int main(){ std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false); std::cout.setf(std::ios_base::fixed);std::cout.precision(15); lint n,m;std::cin>>n>>m; lint X=7*24*60; auto read=[]{ char _;lint d,h,min; std::cin>>d>>h>>_>>min; return ((d-2)*24+h)*60+min; }; std::vector<std::pair<lint,lint>>a(m); for(lint i=0;i<m;i++){ lint l=read(),r=read(); a.at(i)={r+1,l}; } std::sort(ALL(a)); std::vector<lint>occ(X); lint ans=0; for(auto&&p:a){ lint r,l;std::tie(r,l)=p; span sp(occ.begin()+l,occ.begin()+r); if(std::any_of(ALL(sp),[n](lint x){return x==n;}))continue; std::for_each(ALL(sp),[](lint&x){x++;}); ans++; } std::cout<<ans<<'\n'; }