結果

問題 No.59 鉄道の旅
ユーザー ttkkggwwttkkggww
提出日時 2022-04-02 06:06:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 632 bytes
コンパイル時間 5,902 ms
コンパイル使用メモリ 259,992 KB
実行使用メモリ 5,180 KB
最終ジャッジ日時 2023-08-13 06:51:06
合計ジャッジ時間 7,225 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,384 KB
testcase_01 AC 3 ms
4,404 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 3 ms
4,480 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
4,624 KB
testcase_12 AC 12 ms
4,996 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