結果

問題 No.945 YKC饅頭
ユーザー FF256grhyFF256grhy
提出日時 2019-12-08 00:22:22
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 351 ms / 2,000 ms
コード長 2,350 bytes
コンパイル時間 1,849 ms
コンパイル使用メモリ 176,444 KB
実行使用メモリ 25,104 KB
最終ジャッジ日時 2023-08-27 07:19:55
合計ジャッジ時間 10,266 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 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,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 3 ms
4,380 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 13 ms
5,412 KB
testcase_32 AC 7 ms
8,828 KB
testcase_33 AC 56 ms
12,732 KB
testcase_34 AC 158 ms
13,940 KB
testcase_35 AC 272 ms
22,168 KB
testcase_36 AC 204 ms
10,240 KB
testcase_37 AC 187 ms
10,236 KB
testcase_38 AC 167 ms
10,972 KB
testcase_39 AC 33 ms
9,316 KB
testcase_40 AC 28 ms
11,620 KB
testcase_41 AC 12 ms
8,308 KB
testcase_42 AC 257 ms
16,660 KB
testcase_43 AC 174 ms
9,268 KB
testcase_44 AC 206 ms
18,264 KB
testcase_45 AC 276 ms
15,676 KB
testcase_46 AC 6 ms
6,280 KB
testcase_47 AC 156 ms
14,644 KB
testcase_48 AC 32 ms
5,260 KB
testcase_49 AC 58 ms
10,952 KB
testcase_50 AC 294 ms
17,036 KB
testcase_51 AC 344 ms
25,088 KB
testcase_52 AC 338 ms
25,028 KB
testcase_53 AC 326 ms
25,104 KB
testcase_54 AC 351 ms
25,004 KB
testcase_55 AC 342 ms
24,956 KB
testcase_56 AC 7 ms
12,288 KB
testcase_57 AC 7 ms
12,288 KB
testcase_58 AC 162 ms
18,928 KB
testcase_59 AC 183 ms
20,148 KB
testcase_60 AC 62 ms
15,724 KB
testcase_61 AC 158 ms
19,272 KB
testcase_62 AC 149 ms
19,152 KB
testcase_63 AC 8 ms
12,600 KB
testcase_64 AC 68 ms
16,036 KB
testcase_65 AC 56 ms
15,244 KB
testcase_66 AC 52 ms
15,292 KB
testcase_67 AC 105 ms
17,736 KB
testcase_68 AC 64 ms
15,848 KB
testcase_69 AC 21 ms
13,336 KB
testcase_70 AC 27 ms
14,036 KB
testcase_71 AC 27 ms
13,736 KB
testcase_72 AC 86 ms
16,772 KB
testcase_73 AC 172 ms
19,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
auto fl = [](auto a, auto b) { assert(b != 0); return a / b - (a % b != 0 && ((a >= 0) != (b >= 0)) ? 1 : 0); };
auto ce = [](auto a, auto b) { assert(b != 0); return a / b + (a % b != 0 && ((a >= 0) == (b >= 0)) ? 1 : 0); };
auto mo = [](auto a, auto b) { assert(b != 0); a %= b; if(a < 0) { a += abs(b); } return a; };
LL gcd(LL a, LL b) { return (b == 0 ? a : gcd(b, a % b)); }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)

// ---- ----

template<typename T> ostream & operator<<(ostream & os, vector<T> const & v) {
	inc(i, SI(v)) { os << (i == 0 ? "" : " ") << v[i]; }
	return os;
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> L(n + 1), R(n + 1);
	vector<int> c(m);
	inc(i, m) {
		int l, r; string t;
		cin >> l >> r >> t;
		l--;
		L[l].PB(i);
		R[r].PB(i);
		if(t == "Y") { c[i] = 0; }
		if(t == "K") { c[i] = 1; }
		if(t == "C") { c[i] = 2; }
	}
	
	vector<int> ans(3);
	set<int> se = { m };
	inc(i, n) {
		RF(e, R[i]) { se.erase(e); }
		RF(e, L[i]) { se.insert(e); }
		
		int x = * se.begin();
		if(x != m) { ans[c[x]]++; }
	}
	
	cout << ans << endl;
	
	return 0;
}
0