Submission #944805

# Submission time Handle Problem Language Result Execution time Memory
944805 2024-03-13T05:47:13 Z ys2 Fancy Fence (CEOI20_fancyfence) C++14
0 / 100
1000 ms 2512 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, h[1000001], w[1000001], ans, mod=(10e9)+7;
signed main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cin>>n;
	int totalw;
	for (int i=0; i<n; i++){
		cin>>h[i];
	}
	for (int i=0; i<n; i++){
		cin>>w[i];
		totalw+=w[i];
	}
		for (int i=0; i<totalw; i++){
			ans+=i;
			ans%=mod;
		}
	
	if (h[0]==2){
		ans=ans*3;
	}
	ans%=mod;
		
	/*for (int i=1; i<=h[0]; i++){
		ans+=i;
	}
	if (w[0]!=1){
	ans+=h[0]*3*(w[0]-1)-1;
	ans%=mod;
}
	for (int i=1; i<n; i++){
		ans+=3*w[i]*h[i]-1;
		ans%=mod;
	}*/
	cout<<ans;	
	return 0;
}

Compilation message

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:15:9: warning: 'totalw' may be used uninitialized in this function [-Wmaybe-uninitialized]
   15 |   totalw+=w[i];
      |   ~~~~~~^~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1058 ms 2396 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 2512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -