結果

問題 No.59 鉄道の旅
ユーザー chaemonchaemon
提出日時 2014-11-06 23:36:47
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,584 bytes
コンパイル時間 477 ms
コンパイル使用メモリ 74,424 KB
実行使用メモリ 4,976 KB
最終ジャッジ日時 2023-08-26 05:22:11
合計ジャッジ時間 12,480 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 4,293 ms
4,964 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 86 ms
4,380 KB
testcase_09 AC 44 ms
4,376 KB
testcase_10 AC 71 ms
4,376 KB
testcase_11 AC 19 ms
4,380 KB
testcase_12 AC 168 ms
4,376 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// #includes {{{
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cmath>
using namespace std;
// }}}
// pre-written code {{{
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

const int INF=0x3f3f3f3f;

typedef long long Int;
typedef unsigned long long uInt;
#ifdef __MINGW32__
typedef double rn;
#else
typedef long double rn;
#endif

typedef pair<int,int> pii;

/*
#ifdef MYDEBUG
#include"debug.h"
#include"print.h"
#endif
*/
// }}}

int N,K;

int main(){
	scanf("%d %d",&N,&K);
	list<int> v;
	REP(i,N){
		int W;
		scanf("%d",&W);
		if(W<0){
			W*=-1;
			FOR(it,v){
				if((*it)==W){
					v.erase(it);
					break;
				}
			}
		}else{
			int c=0;
			FOR(it,v){
				if(*it>=W)c++;
			}
			if(c<K){
				v.push_back(W);
			}
		}
	}
	cout<<v.size()<<endl;
	return 0;
}
0