結果
| 問題 |
No.59 鉄道の旅
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-26 14:07:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 453 bytes |
| コンパイル時間 | 810 ms |
| コンパイル使用メモリ | 71,376 KB |
| 実行使用メモリ | 13,640 KB |
| 最終ジャッジ日時 | 2024-10-10 11:03:47 |
| 合計ジャッジ時間 | 7,144 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | TLE * 1 -- * 11 |
ソースコード
#include<iostream>
#include<set>
using namespace std;
int main(){
int n, k, w;
multiset<int> s;
cin >> n >> k;
for(int i = 0; i < n; i++){
cin >> w;
if(w > 0){
int bring = distance(s.lower_bound(w), s.end());
if(bring < k) s.insert(w);
}else{
auto it = s.find(-w);
if(it != s.end()) s.erase(it);
}
}
cout << s.size() << endl;
return 0;
}