Submission #745905

#TimeUsernameProblemLanguageResultExecution timeMemory
745905vjudge1Fancy Fence (CEOI20_fancyfence)C++17
0 / 100
1 ms256 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; constexpr ll MOD = 1e9 + 7; ll mul(ll a, ll b){ a %= MOD; b %= MOD; return ((a * b) % MOD); } ll half(ll a){ return a % 2 ? a : a / 2; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int h, w; for (int i=0; i<n; i++){ cin >> h; } for (int i=0; i<n; i++){ int a; cin >> a; w += a; } cout << mul(mul(half(h), half(h+1)), mul(half(w), half(w+1))); }

Compilation message (stderr)

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:31:61: warning: 'w' may be used uninitialized in this function [-Wmaybe-uninitialized]
   31 |     cout << mul(mul(half(h), half(h+1)), mul(half(w), half(w+1)));
      |                                                            ~^~
#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...