Submission #13925

# Submission time Handle Problem Language Result Execution time Memory
13925 2015-04-23T15:36:58 Z model_code 볼질 (OJUZ10_ballparade) C++
100 / 100
7 ms 1084 KB
#include<stdio.h>

int n, bc, base[4], fail;
char yn[2][4]={"No","Yes"};

int main(){
	int i;
	scanf("%d", &n);
	for(i=0; i<n; i++){
		int a;
		scanf("%d", &a);
		if(a==3){ // wild pitch
			bc++;
			fail+=base[3];
			base[3]=base[2], base[2]=base[1], base[1]=0;
			if(bc==4)base[1]=1, bc=0; // BB
			continue;
		}
		if(a==1)bc++;
		if(a==2 || bc==4){ // base on balls
			if(base[3] && base[2] && base[1])fail++;
			else{
				if(base[3] || (base[2] && base[1]))base[3]=1;
				else base[3]=0;
				if(base[2] || base[1])base[2]=1;
				else base[2]=0;
				base[1]=1;
			}
			bc=0;
		}
	}
	printf("%d", fail);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 2 ms 1084 KB Output is correct
7 Correct 6 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 5 ms 1084 KB Output is correct
8 Correct 6 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 2 ms 1084 KB Output is correct
7 Correct 5 ms 1084 KB Output is correct
8 Correct 6 ms 1084 KB Output is correct
9 Correct 6 ms 1084 KB Output is correct
10 Correct 4 ms 1084 KB Output is correct
11 Correct 7 ms 1084 KB Output is correct
12 Correct 6 ms 1084 KB Output is correct
13 Correct 6 ms 1084 KB Output is correct
14 Correct 5 ms 1084 KB Output is correct
15 Correct 6 ms 1084 KB Output is correct