Submission #15734

#TimeUsernameProblemLanguageResultExecution timeMemory
15734cki86201볼질 (OJUZ10_ballparade)C++98
100 / 100
9 ms1084 KiB
#include<stdio.h>

int p[4];

int main(){
	int n;
	scanf("%d",&n);
	int ans = 0;
	for(int i=0, x, now = 0;i<n;i++){
		scanf("%d",&x);
		if(x == 3)ans += p[3], p[3] = p[2], p[2] = p[1], p[1] = 0;
		if(x == 1 || x == 3){
			now++;
		}
		if(x == 2 || now == 4){
			ans += (p[3]&p[2]&p[1]);
			p[3] |= (p[1]&p[2]);
			p[2] |= p[1];
			p[1] = 1, now = 0;
		}
	}
	printf("%d",ans);
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...