Submission #444997

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

Compilation message (stderr)

fancyfence.cpp: In function 'int32_t main()':
fancyfence.cpp:26:51: warning: 'm' may be used uninitialized in this function [-Wmaybe-uninitialized]
   26 |  cout<<multiply(multiply(sumW, sumW+1)/2, multiply(m, m+1)/2)%mod;
      |                                           ~~~~~~~~^~~~~~~~
#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...