Submission #990857

#TimeUsernameProblemLanguageResultExecution timeMemory
990857LucaIlieFancy Fence (CEOI20_fancyfence)C++17
0 / 100
4 ms448 KiB
#include <iostream> using namespace std; #define nmax 10000 #define mod 1000000007 int w[nmax], h[nmax]; int comb2( int x ) { long long rez = 0; rez = rez + x + ((long long) x - 1) * x / 2; return rez % mod; } int main() { int i, j, n, minn; long long rez = 0; cin >> n; for( i = 0; i < n; i++ ) cin >> h[i]; for( i = 0; i < n; i++ ) cin >> w[i]; for( i = 0; i < n; i++ ) { minn = w[i]; rez = ( rez + comb2(w[i] ) * comb2(h[i] ) ) % mod; //cout << rez << " "; for( j = i + 1; j < n; j++ ) { minn = min( minn, w[j] ); rez = ( rez + w[i] * w[j] * comb2( minn ) ) % mod; //cout << rez << " "; } //cout << "\n"; } cout << rez; 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...