結果
| 問題 |
No.945 YKC饅頭
|
| コンテスト | |
| ユーザー |
rhincodon66
|
| 提出日時 | 2019-12-08 00:28:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 134 ms / 2,000 ms |
| コード長 | 1,337 bytes |
| コンパイル時間 | 2,930 ms |
| コンパイル使用メモリ | 180,940 KB |
| 実行使用メモリ | 11,316 KB |
| 最終ジャッジ日時 | 2024-12-26 19:36:07 |
| 合計ジャッジ時間 | 8,137 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 74 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
if(y<h && y>=0 && x<w && x>=0) return true;
return false;
}
struct A{
int l,r,t,i;
};
bool cmp(A a, A b){
if(a.l == b.l) return a.i < b.i;
return a.l < b.l;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n,m;cin >> n >> m;
vector<int> a(n);
vector<A> b(m);
rep(i,m){
A c;
char d;
cin >> c.l >> c.r >> d;
c.l--;
c.r--;
c.i = i;
if(d == 'Y') c.t = 1;
else if(d == 'K') c.t = 2;
else c.t = 3;
b.at(i) = c;
}
sort(b.begin(),b.end(),cmp);
int it = 0;
priority_queue<pair<pii,pii>, vector<pair<pii,pii>>, greater<pair<pii,pii>>> pq;
rep(i,n){
while(it < m && b.at(it).l == i){
pq.push(mp(mp(b.at(it).i,b.at(it).t),mp(b.at(it).l,b.at(it).r)));
it++;
}
while(!pq.empty() && pq.top().second.second < i){
pq.pop();
}
if(!pq.empty()){
a.at(i) = pq.top().first.second;
}
}
vector<int> cnt(4);
rep(i,n) cnt.at(a.at(i))++;
cout << cnt.at(1) << " " << cnt.at(2) << " " << cnt.at(3) << endl;
}
rhincodon66