제출 #1272129

#제출 시각아이디문제언어결과실행 시간메모리
1272129ahmd_ibraaaVudu (COCI15_vudu)C++20
112 / 140
753 ms66900 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> #define double long double #define medal ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define fi first #define sec second #define endl '\n' signed main(){ int n; cin>>n; ordered_set ms; unsigned int a[n+1]; for(int i=1; i<=n; i++){ cin>>a[i]; } int p; cin>>p; ll ans = 0; ll pref = 0; ms.insert(0); for(int i=1; i<=n; i++){ pref += a[i]; pref -= p; int cnt = ms.order_of_key(pref+1); ans += cnt; ms.insert(pref); } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...