結果

問題 No.1965 Heavier
ユーザー otoshigootoshigo
提出日時 2022-06-03 21:44:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,609 bytes
コンパイル時間 2,107 ms
コンパイル使用メモリ 202,760 KB
実行使用メモリ 5,912 KB
最終ジャッジ日時 2023-10-21 01:44:25
合計ジャッジ時間 4,481 ms
ジャッジサーバーID
(参考情報)
judge15 / 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 2 ms
4,348 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 44 ms
5,912 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 46 ms
5,912 KB
testcase_26 AC 44 ms
5,912 KB
testcase_27 AC 50 ms
5,912 KB
testcase_28 AC 49 ms
5,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,a,b) for (int i = a; i < b; i++)
#define rrep2(i,a,b) for (int i = a-1; i >= b; i--)
#define rep3(i,a,b,c) for (int i = a; i < b; i+=c)
#define rrep3(i,a,b,c) for (int i = a-1; i >= b; i-=c)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

template <class T>
struct FenwickTree{
    int n;
    vector<T> bit;
    FenwickTree(int N){
        bit.resize(N+1);
        n = N;
    }
    T sum(int i){
        i++;
        T s = 0;
        while (i > 0){
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }
    T sum(int l, int r){ //[l,r)の総和
        if (l >= r) return 0;
        return sum(r-1) - sum(l-1);
    }
    void add(int i, T x){
        i++;
        while (i <= n){
            bit[i] += x;
            i += i & -i;
        }
    }
};

int n,A[200010],B[200010],C[200010];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    rep(i,n)cin>>A[i];
    rep(i,n)cin>>B[i];
    rep(i,n)C[i]=A[i]-B[i];
    ll ans=0,l=0;
    rep(r,n-1){
        if(C[r]>=C[r+1]){
            ans+=(r-l+1)*(r-l)/2;
            l=r+1;
        }
    }
    ans+=(n-l)*(n-l-1)/2;
    cout<<ans<<"\n";
}
0