結果

問題 No.2859 Falling Balls
ユーザー 沙耶花沙耶花
提出日時 2024-08-25 14:41:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,134 bytes
コンパイル時間 4,917 ms
コンパイル使用メモリ 276,856 KB
実行使用メモリ 27,040 KB
最終ジャッジ日時 2024-08-25 14:41:40
合計ジャッジ時間 11,171 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 WA -
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 90 ms
9,452 KB
testcase_11 AC 311 ms
24,236 KB
testcase_12 AC 17 ms
6,940 KB
testcase_13 AC 282 ms
23,312 KB
testcase_14 AC 262 ms
22,752 KB
testcase_15 AC 90 ms
9,276 KB
testcase_16 AC 123 ms
12,536 KB
testcase_17 AC 121 ms
12,232 KB
testcase_18 AC 13 ms
6,940 KB
testcase_19 AC 182 ms
15,264 KB
testcase_20 AC 342 ms
26,552 KB
testcase_21 AC 373 ms
26,196 KB
testcase_22 AC 348 ms
26,396 KB
testcase_23 AC 332 ms
26,160 KB
testcase_24 AC 375 ms
26,388 KB
testcase_25 AC 343 ms
26,216 KB
testcase_26 AC 341 ms
26,612 KB
testcase_27 AC 349 ms
26,148 KB
testcase_28 AC 376 ms
27,040 KB
testcase_29 AC 356 ms
26,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001

long long op(long long a,long long b){
	return max(a,b);
}
long long e(){
	return -Inf64;
}
int main(){
	long long N,K;
	cin>>N>>K;
	vector<long long> t(N),x(N),c(N);
	rep(i,N)cin>>t[i];
	rep(i,N)cin>>x[i];
	rep(i,N)cin>>c[i];
	vector<vector<long long>> y;
	vector<long long> ys;
	rep(i,N){
		y.push_back({t[i]*K+x[i],t[i]*K-x[i],c[i]});
		ys.push_back(t[i]*K-x[i]);
		y[i][1] *= -1;
	}
	ys.push_back(0);
	sort(ys.begin(),ys.end());
	ys.erase(unique(ys.begin(),ys.end()),ys.end());
	segtree<long long,op,e> seg(ys.size());
	{
		int d = distance(ys.begin(),lower_bound(ys.begin(),ys.end(),0));
		seg.set(d,0);
	}
	sort(y.begin(),y.end());
	rep(i,y.size()){
		int d = distance(ys.begin(),lower_bound(ys.begin(),ys.end(),-y[i][1]));
		long long v = seg.prod(0,d+1);
		if(v==-Inf64)continue;
		v += y[i][2];
		seg.set(d,max(seg.get(d),v));
	}
	cout<<seg.all_prod()<<endl;
    return 0;
}
0