結果

問題 No.1965 Heavier
ユーザー asaringoasaringo
提出日時 2022-06-04 12:20:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 939 bytes
コンパイル時間 2,067 ms
コンパイル使用メモリ 201,152 KB
実行使用メモリ 6,808 KB
最終ジャッジ日時 2023-10-21 02:37:59
合計ジャッジ時間 4,604 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,712 KB
testcase_01 AC 2 ms
5,712 KB
testcase_02 AC 2 ms
5,712 KB
testcase_03 AC 2 ms
5,712 KB
testcase_04 AC 2 ms
5,712 KB
testcase_05 AC 2 ms
5,712 KB
testcase_06 AC 43 ms
6,808 KB
testcase_07 AC 44 ms
6,808 KB
testcase_08 AC 41 ms
6,808 KB
testcase_09 AC 44 ms
6,808 KB
testcase_10 AC 45 ms
6,808 KB
testcase_11 AC 45 ms
6,808 KB
testcase_12 AC 2 ms
5,716 KB
testcase_13 AC 2 ms
5,712 KB
testcase_14 AC 2 ms
5,712 KB
testcase_15 AC 44 ms
6,808 KB
testcase_16 AC 44 ms
6,808 KB
testcase_17 AC 30 ms
6,384 KB
testcase_18 AC 44 ms
6,788 KB
testcase_19 AC 42 ms
6,740 KB
testcase_20 AC 44 ms
6,788 KB
testcase_21 AC 40 ms
6,636 KB
testcase_22 AC 39 ms
6,612 KB
testcase_23 AC 28 ms
6,384 KB
testcase_24 AC 34 ms
6,460 KB
testcase_25 AC 41 ms
6,808 KB
testcase_26 AC 40 ms
6,808 KB
testcase_27 AC 45 ms
6,808 KB
testcase_28 AC 46 ms
6,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std ;
#define fast_input_output ios::sync_with_stdio(false); cin.tie(nullptr);
typedef long long ll ;
typedef long double ld ;
typedef pair<ll,ll> P ;
typedef tuple<ll,ll,ll> TP ;
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
#define bit_count(x) __builtin_popcountll(x)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a / gcd(a,b) * b
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define rrep(i,a,b) for(int i = a ; i < b ; i++)
#define endl "\n"

int n ;
ll A[202020] , B[202020] ;

int main(){
    fast_input_output
    cin >> n ;
    rep(i,n) cin >> A[i] ;
    rep(i,n) cin >> B[i] ;
    ll p = A[0] + B[0] ;
    ll m = A[0] - B[0] ;
    ll res = 0 , count = 1 ;
    rrep(i,1,n){
        ll np = A[i] + B[i] ;
        ll nm = A[i] - B[i] ;
        if(np > p && nm > m) res += count++ ;
        else count = 1 ;
        p = np ;
        m = nm ;
    }
    cout << res << endl ;
}
0