結果
問題 |
No.945 YKC饅頭
|
ユーザー |
![]() |
提出日時 | 2019-12-08 01:07:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,150 bytes |
コンパイル時間 | 1,689 ms |
コンパイル使用メモリ | 172,508 KB |
実行使用メモリ | 15,024 KB |
最終ジャッジ日時 | 2024-12-27 13:04:07 |
合計ジャッジ時間 | 6,438 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 74 |
ソースコード
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; //template #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(a);i>(b);i--) #define ALL(v) (v).begin(),(v).end() typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff; template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; } template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; } //template end int a[200010]={},r[200010],col[200010]; vector<int> st[200010]; int main(){ int n,m; scanf("%d%d",&n,&m); rep(i,0,m){ int l; scanf("%d%d",&l,&r[i]); l--; char c; cin>>c; if(c=='Y')col[i]=1; if(c=='K')col[i]=2; if(c=='C')col[i]=3; st[l].push_back(i); } priority_queue<int,vector<int>,greater<int>> pq; rep(i,0,n){ for(int j:st[i])pq.push(j); while(pq.size()){ int j=pq.top(); if(r[j]<=i){pq.pop(); continue;} a[i]=col[j]; break; } } int ans[3]={}; rep(i,0,n)if(a[i])ans[a[i]-1]++; rep(i,0,3)printf("%d\n",ans[i]); return 0; }