Submission #445004

#TimeUsernameProblemLanguageResultExecution timeMemory
445004fuad27Fancy Fence (CEOI20_fancyfence)C++14
0 / 100
1 ms204 KiB
#include<bits/stdc++.h> using namespace std; #define mod 1000000007 typedef long long ll; #define int long long ll rec(ll a, ll b) { ll x = 1; if(a%2 == 0) { x*=(a/2)%mod; x*=a+1; x%=mod; } else { x*=((a+1)/2)%mod; x*=a%mod; x%=mod; } if(b%2 == 0) { x*=(b/2)%mod; x*=b+1; x%=mod; } else { x*=((b+1)/2)%mod; x*=b%mod; x%=mod; } return x%mod; } int32_t main () { ll n, m; cin >> n; ll sumW = 0; for(ll i = 0;i<n;i++) { ll h; cin >> h; m = h; m%=mod; } for(ll i = 0;i<n;i++) { ll w; cin >> w; sumW += w%mod; sumW%=mod; } cout<<rec(sumW, m)<<endl; }

Compilation message (stderr)

fancyfence.cpp: In function 'int32_t main()':
fancyfence.cpp:47:19: warning: 'm' may be used uninitialized in this function [-Wmaybe-uninitialized]
   47 |  cout<<rec(sumW, m)<<endl;
      |                   ^
#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...