結果
| 問題 |
No.945 YKC饅頭
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-04-14 21:47:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 404 ms / 2,000 ms |
| コード長 | 970 bytes |
| コンパイル時間 | 2,787 ms |
| コンパイル使用メモリ | 203,664 KB |
| 最終ジャッジ日時 | 2025-01-09 18:58:14 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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+1);
events.at(r).push_back(-i-1);
}
events.at(0).push_back(m+1);
events.at(n).push_back(-m-1);
std::set<lint>set;
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)set.insert(x-1);
else set.erase(-x-1);
}
char now=s.at(*set.begin());
(now=='Y'?y:now=='K'?k:now=='C'?c:z)++;
}
std::cout<<y<<' '<<k<<' '<<c<<'\n';
}
ngtkana