Submission #936340

#TimeUsernameProblemLanguageResultExecution timeMemory
936340VMaksimoski008Fancy Fence (CEOI20_fancyfence)C++14
15 / 100
59 ms3156 KiB
#include <bits/stdc++.h> #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() //#define int long long using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; const int mod = 1e9 + 7; const int inv = 500000004; const int LOG = 20; const int maxn = 1e5 + 5; const double eps = 1e-9; int32_t main() { int n; cin >> n; set<int> diff; vector<int> h(n), w(n); for(int &x : h) cin >> x, diff.insert(x); for(int &x : w) cin >> x; if(diff.size() == 1) { ll W = 0; for(int &x : w) W += x, W %= mod; ll p1 = W * (W + 1) % mod * inv % mod; ll p2 = 1ll * h[0] * (h[0] + 1) % mod * inv % mod; cout << (p1 * p2) % mod << '\n'; } 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...