結果

問題 No.1965 Heavier
ユーザー 沙耶花沙耶花
提出日時 2022-06-03 21:32:35
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 5,402 ms
コンパイル使用メモリ 260,760 KB
実行使用メモリ 10,536 KB
最終ジャッジ日時 2023-10-21 01:39:27
合計ジャッジ時間 8,217 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 61 ms
10,536 KB
testcase_07 AC 61 ms
10,536 KB
testcase_08 AC 85 ms
10,536 KB
testcase_09 AC 78 ms
10,536 KB
testcase_10 AC 77 ms
10,536 KB
testcase_11 AC 77 ms
10,536 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 64 ms
10,536 KB
testcase_16 AC 64 ms
10,536 KB
testcase_17 AC 44 ms
9,744 KB
testcase_18 AC 61 ms
10,536 KB
testcase_19 AC 60 ms
10,536 KB
testcase_20 AC 61 ms
10,536 KB
testcase_21 AC 56 ms
10,272 KB
testcase_22 AC 55 ms
10,272 KB
testcase_23 AC 37 ms
7,368 KB
testcase_24 AC 49 ms
10,008 KB
testcase_25 AC 86 ms
10,536 KB
testcase_26 AC 84 ms
10,536 KB
testcase_27 AC 62 ms
10,536 KB
testcase_28 AC 62 ms
10,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int op(int a,int b){
	return max(a,b);
}

int e(){
	return -Inf;
}
int main() {
	
	int n;
	cin>>n;
	
	vector<int> a(n),b(n);
	rep(i,n)scanf("%d",&a[i]);
	rep(i,n)scanf("%d",&b[i]);
	vector<int> x(n),y(n);
	rep(i,n){
		x[i] = a[i]+b[i];
		y[i] = a[i]-b[i];
	}
	
	segtree<int,op,e> s0(x),s1(y);
	
	long long ans = 0LL;
	int l = 0;
	rep(i,n){
		while(true){
			bool f = true;
			if(s0.prod(l,i)>=x[i])f = false;
			if(s1.prod(l,i)>=y[i])f = false;
			if(f)break;
			l++;
		}
		//cout<<i<<','<<l<<endl;
		ans += i-l;
	}
	cout<<ans<<endl;
	
}
0