結果
問題 |
No.59 鉄道の旅
|
ユーザー |
![]() |
提出日時 | 2016-02-09 17:02:31 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 951 bytes |
コンパイル時間 | 1,531 ms |
コンパイル使用メモリ | 161,644 KB |
実行使用メモリ | 10,112 KB |
最終ジャッジ日時 | 2024-12-24 22:06:42 |
合計ジャッジ時間 | 21,343 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 9 TLE * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(ll i=0; i<(ll)(n); i++) #define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++) #define pb push_back #define INF 1000000007 #define all(a) (a).begin(),(a).end() typedef long long ll; typedef pair<int,int> p; typedef pair<p,int> pv; int dy[4]={-1,1,0,0}; int dx[4]={0,0,1,-1}; int N,K; int main(){ ios::sync_with_stdio(false); cin >> N >> K; multiset<int> train; REP(i,N){ int t; cin >> t; int cnt=0; //おろす if(t<0){ t=-t; auto it=train.lower_bound(t); if(it==train.end()) continue; if(*it==t) train.erase(it); } //つむ else{ auto it=train.lower_bound(t); int tmp=distance(it,train.end()); if(K-1<tmp) continue; train.insert(t); } } cout << train.size() << endl; return 0; }