Submission #945643

# Submission time Handle Problem Language Result Execution time Memory
945643 2024-03-14T05:50:04 Z Sandarach151 Fancy Fence (CEOI20_fancyfence) C++17
12 / 100
1000 ms 1276 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

const int MODD = 1e9+7;

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	int h[n];
	int w[n];
	for(int i=0; i<n; i++){
		cin >> h[i];
	}
	for(int i=0; i<n; i++){
		cin >> w[i];
	}
	int ans = 0;
	for(int i=0; i<n; i++){
		ans += (w[i]+1)*(w[i])*(h[i]+1)*(h[i])/4;
		ans %= MODD;
	}
	for(int i=0; i<n; i++){
		int minn = h[i];
		for(int j=i+1; j<n; j++){
			minn = min(minn, h[j]);
			ans += w[i]*w[j]*(minn*(minn+1)/2);
			ans %= MODD;
		}
	}
	cout << ans << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Execution timed out 1008 ms 1276 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -