結果

問題 No.945 YKC饅頭
ユーザー rhincodon66rhincodon66
提出日時 2019-12-08 00:28:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 1,337 bytes
コンパイル時間 1,819 ms
コンパイル使用メモリ 178,452 KB
実行使用メモリ 12,328 KB
最終ジャッジ日時 2023-08-27 07:29:46
合計ジャッジ時間 7,022 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 6 ms
4,376 KB
testcase_32 AC 4 ms
4,380 KB
testcase_33 AC 19 ms
5,324 KB
testcase_34 AC 42 ms
7,156 KB
testcase_35 AC 89 ms
11,544 KB
testcase_36 AC 61 ms
10,860 KB
testcase_37 AC 53 ms
9,988 KB
testcase_38 AC 48 ms
7,168 KB
testcase_39 AC 13 ms
4,492 KB
testcase_40 AC 11 ms
4,496 KB
testcase_41 AC 5 ms
4,376 KB
testcase_42 AC 64 ms
11,108 KB
testcase_43 AC 52 ms
9,784 KB
testcase_44 AC 53 ms
7,728 KB
testcase_45 AC 70 ms
11,536 KB
testcase_46 AC 3 ms
4,376 KB
testcase_47 AC 42 ms
7,136 KB
testcase_48 AC 12 ms
4,376 KB
testcase_49 AC 23 ms
5,412 KB
testcase_50 AC 71 ms
11,172 KB
testcase_51 AC 99 ms
11,828 KB
testcase_52 AC 108 ms
12,232 KB
testcase_53 AC 86 ms
11,288 KB
testcase_54 AC 81 ms
11,344 KB
testcase_55 AC 108 ms
12,328 KB
testcase_56 AC 3 ms
4,380 KB
testcase_57 AC 3 ms
4,380 KB
testcase_58 AC 57 ms
5,900 KB
testcase_59 AC 71 ms
6,504 KB
testcase_60 AC 23 ms
4,580 KB
testcase_61 AC 59 ms
5,952 KB
testcase_62 AC 58 ms
5,904 KB
testcase_63 AC 4 ms
4,380 KB
testcase_64 AC 26 ms
4,900 KB
testcase_65 AC 20 ms
4,636 KB
testcase_66 AC 19 ms
4,584 KB
testcase_67 AC 41 ms
5,468 KB
testcase_68 AC 25 ms
4,944 KB
testcase_69 AC 9 ms
4,380 KB
testcase_70 AC 11 ms
4,380 KB
testcase_71 AC 11 ms
4,376 KB
testcase_72 AC 32 ms
5,164 KB
testcase_73 AC 66 ms
6,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0