Submission #944968

# Submission time Handle Problem Language Result Execution time Memory
944968 2024-03-13T09:11:10 Z akqxolotl Fancy Fence (CEOI20_fancyfence) C++17
0 / 100
140 ms 262144 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
 
 
signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	
	int n;cin>>n;
	vector<pair<int,int>> v;
	int h=0,w=0,wt=0;
	int hh[n],ww[n];
	for(int i=0;i<n;i++)cin>>hh[i];
	for(int i=0;i<n;i++)cin>>ww[i];
	
	for(int i=0;i<n;i++){
		h=hh[i];w=ww[i];
		if(h==2){
			if(v.back().second==wt){
				int temp=v.back().first;
				v.pop_back();
				v.push_back({temp,wt+w});
			}
			else{
				v.push_back({wt,wt+w});
			}
		}
		wt+=w;
	}
	int f[wt+1];
	f[0]=0;
	for(int i=1;i<=wt;i++){
		f[i]=f[i-1]+i;
	}
	int ans=f[wt];
	for(auto i:v){
		
		int t=i.second-i.first;
		ans+=f[t]*2;
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 140 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -