Submission #1109023

#TimeUsernameProblemLanguageResultExecution timeMemory
1109023Ak_16Fancy Fence (CEOI20_fancyfence)C++17
0 / 100
6 ms1872 KiB
#include <iostream> using namespace std; int 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...