結果
| 問題 |
No.945 YKC饅頭
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-09 02:18:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 228 ms / 2,000 ms |
| コード長 | 591 bytes |
| コンパイル時間 | 835 ms |
| コンパイル使用メモリ | 73,464 KB |
| 実行使用メモリ | 18,116 KB |
| 最終ジャッジ日時 | 2025-01-03 06:15:04 |
| 合計ジャッジ時間 | 7,355 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 74 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
6 | main()
| ^~~~
ソースコード
#include<iostream>
#include<queue>
using namespace std;
int N,M;
vector<pair<int,pair<int,int> > >A[2<<17];
main()
{
cin>>N>>M;
for(int i=0;i<M;i++)
{
int L,R;char c;cin>>L>>R>>c;
A[L-1].push_back(make_pair(i,make_pair(R,c=='Y'?0:c=='K'?1:2)));
}
priority_queue<pair<int,pair<int,int> > >P;
int ans[3]={};
for(int i=0;i<N;i++)
{
for(pair<int,pair<int,int> >p:A[i])
{
P.push(make_pair(-p.first,p.second));
}
while(!P.empty()&&P.top().second.first<=i)P.pop();
if(!P.empty())
{
ans[P.top().second.second]++;
}
}
cout<<ans[0]<<" "<<ans[1]<<" "<<ans[2]<<endl;
}