Submission #674764

#TimeUsernameProblemLanguageResultExecution timeMemory
674764KINGFancy Fence (CEOI20_fancyfence)C++14
0 / 100
163 ms320 KiB
#include<bits/stdc++.h> #define NOT_STONKS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) using namespace std; const int maxn = 2e5 + 10; //4e6 + 10; //3e5 + 10; const int mod = 1e9 + 7; //998244353; typedef long long ll; int t, n, m, h[maxn], w[maxn]; int main() { NOT_STONKS; cin >> n; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < n; i++) cin >> w[i]; ll ans = 0; for (int i = 0; i < n; i++) for (int j = i; j < n; j++) { int mn = mod; for (int k = i; k <= j; k++) mn = min(mn, h[i]); ans += 1ll * mn * (mn + 1) / 2; } cout << ans << endl; return 0; }
#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...