Submission #1109025

#TimeUsernameProblemLanguageResultExecution timeMemory
1109025Ak_16Fancy Fence (CEOI20_fancyfence)C++17
0 / 100
7 ms3528 KiB
#include <iostream> using namespace std; #define int long long signed main() { int n; int h[200005]; int w[200005]; cin>>n; for(int i=1; i<=n; i++){cin>>h[i];} for(int i=1; i<=n; i++){cin>>w[i];} int ans=0; int p=1e9+7; for(int i=1; i<=n; i++){ ans += (w[i] * (w[i]+1) / 2 % p) % p * (h[i] * (h[i]+1) / 2 % p) % p; ans %= p; cout<<ans<<" "; } for(int i=1; i<n; i++){ int mn=h[i]; for(int j=i+1; j<=n; j++){ mn=min(mn, h[j]); ans += w[i] * w[j] % p * (mn * (mn+1) / 2 % p) % p; ans %= p; } } cout<<ans; }
#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...