Submission #628805

#TimeUsernameProblemLanguageResultExecution timeMemory
628805a_aguiloFancy Fence (CEOI20_fancyfence)C++14
15 / 100
82 ms2132 KiB
#include<bits/stdc++.h> using namespace std; int MOD = 1e9+7; int main(){ int n; cin >> n; vector<long long int> heights(n); vector<long long int> widths(n); for(int i = 1; i <= n; ++i) cin >> heights[n-i]; for(int i = 1; i <= n; ++i) cin >> widths[n-i]; long long int ans = 0; long long int W = 0; long long int H; for(int i = 0; i < n; ++i){ W += widths[i]; W%=MOD; long long chooseW = (W*(W+1)/2)%MOD; if(i == n-1) H = heights[i]; else H = heights[i]- heights[i+1]; long long chooseh = (H*(H+1)/2)%MOD; ans+= (chooseW*chooseh)%MOD; if(i != n-1){ ans += (H*chooseW)%MOD; } 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...