Submission #871404

#TimeUsernameProblemLanguageResultExecution timeMemory
871404Trisanu_DasFancy Fence (CEOI20_fancyfence)C++17
12 / 100
162 ms262144 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int N, L; ll h[100005], w[100005]; vector<ll> nh; int main(){ cin >> N; for(int i=0;i<N;i++) cin >> h[i]; for(int i=0;i<N;i++){ cin >> w[i]; for(int j=0;j<w[i];j++){ L++; nh.push_back(h[i]); } } ll ans=0; for(int i=0;i<L;i++){ for(int j=0; j<=i; j++){ ll m=INT_MAX; for(int k=j;k<=i;k++) m = min(m, nh[k]); (ans += (m*(m+1))/2LL) %= 100000007; } } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...