結果

問題 No.59 鉄道の旅
ユーザー ttkkggwwttkkggww
提出日時 2022-04-02 06:06:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 632 bytes
コンパイル時間 4,498 ms
コンパイル使用メモリ 263,288 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 00:45:32
合計ジャッジ時間 6,272 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,812 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 3 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 4 ms
6,944 KB
testcase_12 AC 11 ms
6,944 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
int n,k;
vector<int> w;

int op(int l,int r){
	return l+r;
}

int e(){
	return 0;
}


void solve(){
	segtree<int,op,e> SEG(100001);
	for(int i = 0;i<n;i++){
		if(w[i]<0){
			if(SEG.get(-w[i])<=0){
			}else{
				SEG.set(-w[i],SEG.get(-w[i])-1);
			}
		}else{
			if(SEG.prod(w[i],100001)>=k){
			}else{
				SEG.set(w[i],SEG.get(w[i])+1);
			}
		}
	}
	cout<<SEG.all_prod()<<endl;
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> n >> k;
	w = vector<int>(n);
	for(auto &i:w)cin >> i;
	solve();
}
0