結果
問題 |
No.945 YKC饅頭
|
ユーザー |
![]() |
提出日時 | 2020-04-14 22:05:33 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 208 ms / 2,000 ms |
コード長 | 1,138 bytes |
コンパイル時間 | 2,418 ms |
コンパイル使用メモリ | 200,848 KB |
最終ジャッジ日時 | 2025-01-09 19:00:23 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 74 |
ソースコード
#include<bits/stdc++.h> #define ALL(v) std::begin(v),std::end(v) using lint=long long; using ld=long double; template<class T>using numr=std::numeric_limits<T>; 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; std::string s(m+1,'$'); std::vector<std::vector<lint>>events(n+1); for(lint i=0;i<m;i++){ lint l,r;std::cin>>l>>r;l--; std::cin>>s.at(i); events.at(l).push_back(i); events.at(r).push_back(-i-1); } events.at(0).push_back(m); events.at(n).push_back(-m-1); std::vector<lint>ckd(m+1); std::priority_queue<lint>que; lint y=0,k=0,c=0,z=0; for(lint i=0;i<n;i++){ for(lint x:events.at(i)){ if(0<=x){ que.push(-x); ckd.at(x)=true; }else{ ckd.at(-x-1)=false; } while(!ckd.at(-que.top()))que.pop(); } char now=s.at(-que.top()); (now=='Y'?y:now=='K'?k:now=='C'?c:z)++; } std::cout<<y<<' '<<k<<' '<<c<<'\n'; }