結果
| 問題 |
No.59 鉄道の旅
|
| コンテスト | |
| ユーザー |
dora_maruta
|
| 提出日時 | 2014-11-11 16:37:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3,839 ms / 5,000 ms |
| コード長 | 652 bytes |
| コンパイル時間 | 723 ms |
| コンパイル使用メモリ | 62,156 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-24 20:22:58 |
| 合計ジャッジ時間 | 9,267 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 |
ソースコード
#include<iostream>
#include<vector>
int main(){
std::vector<int> contena;
int n, k;
std::cin >> n >> k;
int d = 0;
for (int i = 0; i < n; ++i){
int w;
std::cin >> w;
if (w > 0){
int cnt = 0;
for (auto it = contena.begin(); it != contena.end(); ++it){
if (*it >= w)cnt++;
}
if (cnt < k)contena.push_back(w);
}
else{
for (auto it = contena.begin(); it != contena.end(); ++it){
if (*it == -w){
contena.erase(it);
break;
}
}
//contena.erase(std::remove(contena.begin(), contena.end(), -w),contena.end());
}
}
std::cout << contena.size() << std::endl;
return 0;
}
dora_maruta