답안 #380232

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
380232 2021-03-20T15:59:21 Z vishesh312 Vudu (COCI15_vudu) C++17
42 / 140
1000 ms 45776 KB
#include "bits/stdc++.h"
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()

using ll = long long;
const int mod = 1e9+7;

void solve(int tc) {
    int n;
    cin >> n;
    vector<int> v(n+1);
    for (int i = 1; i <= n; ++i) cin >> v[i];
    ll p;
    cin >> p;
    ll ans = 0;
    ordered_set s;
    s.insert(-1);
    for (int i = 1; i <= n; ++i) {
        v[i] += v[i-1]-p;
        ans += s.order_of_key(v[i]);
        s.insert(v[i]-1);
    }
    cout << ans << '\n';
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int tc = 1;
    //cin >> tc;
    for (int i = 1; i <= tc; ++i) solve(i);
    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 748 KB Output is correct
2 Correct 3 ms 620 KB Output is correct
3 Correct 3 ms 620 KB Output is correct
4 Execution timed out 1103 ms 45548 KB Time limit exceeded
5 Incorrect 619 ms 28140 KB Output isn't correct
6 Execution timed out 1089 ms 43896 KB Time limit exceeded
7 Execution timed out 1089 ms 45632 KB Time limit exceeded
8 Incorrect 990 ms 39660 KB Output isn't correct
9 Execution timed out 1075 ms 45776 KB Time limit exceeded
10 Execution timed out 1087 ms 44548 KB Time limit exceeded