Submission #963029

#TimeUsernameProblemLanguageResultExecution timeMemory
963029antonFancy Fence (CEOI20_fancyfence)C++17
12 / 100
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define pii pair<int,int> const int MAX_N = 1e5; int h[MAX_N]; int nbp(int u){ return u*(u+1)/2; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin>>n; for(int i = 0; i<n; i++){ cin>>h[i]; } for(int i = 0; i<n; i++){ int w; cin>>w; } int res= 0; for(int l = 0; l<n; l++){ int minh= h[l]; for(int r = l; r<n; r++){ minh= min(minh, h[r]); res += nbp(minh); } } cout<<res<<endl; }
#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...