結果

問題 No.945 YKC饅頭
ユーザー ransewhaleransewhale
提出日時 2019-12-08 04:41:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,444 bytes
コンパイル時間 1,442 ms
コンパイル使用メモリ 167,028 KB
実行使用メモリ 27,312 KB
最終ジャッジ日時 2023-08-27 15:06:46
合計ジャッジ時間 9,884 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
25,640 KB
testcase_01 AC 8 ms
25,668 KB
testcase_02 AC 7 ms
25,824 KB
testcase_03 AC 7 ms
25,620 KB
testcase_04 AC 7 ms
25,704 KB
testcase_05 AC 7 ms
25,668 KB
testcase_06 AC 7 ms
25,588 KB
testcase_07 AC 8 ms
25,612 KB
testcase_08 AC 7 ms
25,840 KB
testcase_09 AC 8 ms
25,708 KB
testcase_10 AC 7 ms
25,664 KB
testcase_11 AC 7 ms
25,612 KB
testcase_12 AC 7 ms
25,628 KB
testcase_13 AC 7 ms
25,624 KB
testcase_14 AC 7 ms
25,668 KB
testcase_15 AC 6 ms
25,640 KB
testcase_16 AC 7 ms
25,652 KB
testcase_17 AC 8 ms
25,636 KB
testcase_18 AC 8 ms
25,604 KB
testcase_19 AC 7 ms
25,656 KB
testcase_20 AC 8 ms
25,856 KB
testcase_21 AC 8 ms
25,728 KB
testcase_22 AC 9 ms
25,760 KB
testcase_23 AC 8 ms
25,628 KB
testcase_24 AC 9 ms
25,648 KB
testcase_25 AC 8 ms
25,592 KB
testcase_26 AC 8 ms
25,612 KB
testcase_27 AC 8 ms
25,820 KB
testcase_28 AC 7 ms
25,588 KB
testcase_29 AC 8 ms
25,640 KB
testcase_30 AC 7 ms
25,672 KB
testcase_31 AC 18 ms
25,896 KB
testcase_32 AC 20 ms
26,660 KB
testcase_33 AC 60 ms
26,796 KB
testcase_34 AC 123 ms
26,424 KB
testcase_35 AC 203 ms
27,056 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 121 ms
25,896 KB
testcase_39 AC 38 ms
26,312 KB
testcase_40 AC 40 ms
26,836 KB
testcase_41 AC 22 ms
26,420 KB
testcase_42 AC 180 ms
26,340 KB
testcase_43 WA -
testcase_44 AC 158 ms
26,876 KB
testcase_45 WA -
testcase_46 AC 15 ms
26,172 KB
testcase_47 AC 123 ms
26,484 KB
testcase_48 AC 29 ms
25,716 KB
testcase_49 AC 57 ms
26,540 KB
testcase_50 AC 221 ms
26,416 KB
testcase_51 AC 288 ms
27,160 KB
testcase_52 AC 290 ms
27,204 KB
testcase_53 AC 294 ms
27,144 KB
testcase_54 AC 299 ms
27,144 KB
testcase_55 AC 301 ms
27,220 KB
testcase_56 AC 27 ms
27,136 KB
testcase_57 AC 29 ms
27,292 KB
testcase_58 AC 173 ms
27,172 KB
testcase_59 AC 175 ms
27,236 KB
testcase_60 AC 80 ms
27,164 KB
testcase_61 AC 159 ms
27,172 KB
testcase_62 AC 150 ms
27,208 KB
testcase_63 AC 29 ms
27,236 KB
testcase_64 AC 86 ms
27,220 KB
testcase_65 AC 72 ms
27,268 KB
testcase_66 AC 69 ms
27,204 KB
testcase_67 AC 115 ms
27,172 KB
testcase_68 AC 84 ms
27,172 KB
testcase_69 AC 44 ms
27,164 KB
testcase_70 AC 49 ms
27,212 KB
testcase_71 AC 47 ms
27,172 KB
testcase_72 AC 99 ms
27,164 KB
testcase_73 AC 163 ms
27,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, char> P;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

struct node{
	int id,chl,chr,l,r;
	P v;
};

int n,s = 0;
node t[816225];
P ans[225816];

int init(int l=0, int r=n){
	int id;
	id = s; ++s;
	t[id].l = l; t[id].r = r;
	t[id].id = id; t[id].v = P(n,'@');
	if(r-l>1){
		t[id].chl = init(l,(l+r)/2);
		t[id].chr = init((l+r)/2,r);
	}
	return id;
}

void update(int a, int b, P v, int i=0, int l=0, int r=n){
	if(b<=l || r<=a){
		return;
	}else if(a<=l && r<=b){
		t[i].v = min(t[i].v,v);
	}else{
		update(a,b,v,t[i].chl,l,(l+r)/2);
		update(a,b,v,t[i].chr,(l+r)/2,r);
	}
}

int main(void){
	int m,i,l,r,y=0,k=0,c=0,j;
	char ch;
	cin >> n >> m;
	init();
	for(i=0; i<m; ++i){
		cin >> l >> r >> ch;
		update(l-1,r,P(i,ch));
	}
	for(i=0; i<n; ++i){
		l = 0; r = n;
		j = 0; ans[i] = t[j].v;
		while(r-l>1){
			m = (r+l)/2;
			if(i<m){
				j = t[j].chl;
				r = m;
			}else{
				j = t[j].chr;
				l = m;
			}
			ans[i] = min(ans[i],t[j].v);
		}
	}
	for(i=0; i<n; ++i){
		switch(ans[i].second){
			case 'Y':
			++y; break;
			case 'K':
			++k; break;
			case 'C':
			++c; break;
		}
	}
	cout << y << " " << k << " " << c << endl;
	return 0;
}
0