結果
問題 | No.945 YKC饅頭 |
ユーザー |
![]() |
提出日時 | 2019-12-08 01:13:50 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 182 ms / 2,000 ms |
コード長 | 895 bytes |
コンパイル時間 | 1,477 ms |
コンパイル使用メモリ | 81,204 KB |
実行使用メモリ | 13,576 KB |
最終ジャッジ日時 | 2024-12-27 14:57:53 |
合計ジャッジ時間 | 7,336 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 74 |
ソースコード
#include <iostream> #include <algorithm> #include <iomanip> #include <vector> #include <queue> #include <set> #include <map> using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int N, M; cin >> N >> M; set<int> st; int y = 0, k = 0, c = 0; for(int i = 0; i < N; i++){ st.insert(i+1); } for(int i = 0; i < M; i++){ int L, R; char T; cin >> L >> R >> T; auto p = st.lower_bound(L); vector<int> v; for(auto iter = p; iter != st.end() && *iter <= R; iter++){ if(T == 'Y') y++; if(T == 'K') k++; if(T == 'C') c++; v.push_back(*iter); } for(auto iter = v.begin(); iter != v.end(); iter++) st.erase(*iter); } cout << y << ' ' << k << ' ' << c << endl; }