結果
問題 | No.945 YKC饅頭 |
ユーザー |
![]() |
提出日時 | 2020-01-30 20:13:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 236 ms / 2,000 ms |
コード長 | 615 bytes |
コンパイル時間 | 756 ms |
コンパイル使用メモリ | 73,088 KB |
実行使用メモリ | 13,032 KB |
最終ジャッジ日時 | 2024-09-16 03:50:06 |
合計ジャッジ時間 | 10,128 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 74 |
ソースコード
#include <set>#include <string>#include <iostream>using namespace std;int main() {int N, M;cin >> N >> M;set<int> s;string ans(N, '?');for (int i = 0; i < N; ++i) {s.insert(i);}for (int i = 0; i < M; ++i) {int L, R; string T;cin >> L >> R >> T; --L, --R;set<int>::iterator it = s.lower_bound(L);while (it != s.end() && *it <= R) {ans[*it] = T[0];it = s.erase(it);}}int cy = 0, ck = 0, cc = 0;for (int i = 0; i < N; ++i) {if (ans[i] == 'Y') ++cy;if (ans[i] == 'K') ++ck;if (ans[i] == 'C') ++cc;}cout << cy << ' ' << ck << ' ' << cc << endl;return 0;}