Submission #1046158

#TimeUsernameProblemLanguageResultExecution timeMemory
1046158ByeWorldFancy Fence (CEOI20_fancyfence)C++14
0 / 100
1 ms2396 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3") #define int long long #define ll long long #define pb push_back #define fi first #define se second #define lf (id<<1) #define rg ((id<<1)|1) #define md ((l+r)>>1) #define ld long double using namespace std; typedef pair<int,int> pii; typedef pair<int,pii> ipii; typedef pair<ld,ld> pll; const int MAXN = 3e5+15; const int INF = 3e18+10; const int MX = 2e18; const int MOD = 1e9+7; void chmn(int &a, int b){ a = min(a, b); } void chsum(int &a, int b){ a = (a+b)%MOD; } void chmul(int &a, int b){ a = (a*b)%MOD; } int mul(int a, int b){ return (a*b)%MOD; } int sum(int a, int b){ return (a+b)%MOD; } int expo(int a, int b){ if(b==0) return 1; int te = expo(a, b/2); te = mul(te, te); return (b%2 ? mul(te, a) : te); } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int n; int h[MAXN], w[MAXN]; signed main(){ // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for(int i=1; i<=n; i++) cin >> h[i]; int sum = 0; for(int i=1; i<=n; i++){ cin >> w[i]; sum += w[i]; } cout << (((sum*(sum+1)/2)%MOD) * ((h[1]*(h[1]+1))/2)%MOD)%MOD << '\n'; }
#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...