Submission #674768

#TimeUsernameProblemLanguageResultExecution timeMemory
674768KINGFancy Fence (CEOI20_fancyfence)C++14
0 / 100
170 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++) { ll mn = mod; for (int k = i; k <= j; k++) mn = min(mn, 1ll * h[i]); ans += 1ll * mn * (mn + 1) / 2; ans %= mod; } 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...