#include <stdio.h>
int n;
int a[50010];
int b[5];
int ball;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&a[i]);
}
for(int i=1;i<=n;i++){
if(a[i]==1)
{
ball++;
if(ball==4)
{
ball=0;
b[0]++;
for(int j=3;j>=0;j--){
if((j==0||j==1)&&b[j]==1)
{
b[j+1]++;
b[j]--;
}
if(j==2&&b[j]==1&&b[j-1]==1)
{
b[j+1]++;
b[j]--;
}
if(j==3&&b[j]==1&&b[j-1]==1&&b[j-2]==1)
{
b[j+1]++;
b[j]--;
}
}
}
}
if(a[i]==2)
{
ball=0;
b[0]++;
for(int j=3;j>=0;j--){
if((j==0||j==1)&&b[j]==1)
{
b[j+1]++;
b[j]--;
}
if(j==2&&b[j]==1&&b[j-1]==1)
{
b[j+1]++;
b[j]--;
}
if(j==3&&b[j]==1&&b[j-1]==1&&b[j-2]==1)
{
b[j+1]++;
b[j]--;
}
}
}
if(a[i]==3)
{
ball++;
if(ball==4)
{
ball=0;
b[0]++;
}
for(int j=3;j>=0;j--){
if(b[j]==1)
{
b[j+1]++;
b[j]--;
}
}
}
for(int j=0;j<=4;j++){
printf("%d ",b[j]);
}
puts("");
}
printf("%d",b[4]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
4 |
Incorrect |
14 ms |
1276 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
2 |
Incorrect |
43 ms |
1276 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
5 |
Incorrect |
18 ms |
1276 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
2 |
Incorrect |
31 ms |
1276 KB |
Output isn't correct |
3 |
Incorrect |
34 ms |
1276 KB |
Output isn't correct |
4 |
Incorrect |
41 ms |
1276 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
8 |
Incorrect |
30 ms |
1276 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
10 |
Incorrect |
21 ms |
1276 KB |
Output isn't correct |
11 |
Incorrect |
34 ms |
1276 KB |
Output isn't correct |
12 |
Incorrect |
42 ms |
1276 KB |
Output isn't correct |
13 |
Incorrect |
22 ms |
1276 KB |
Output isn't correct |
14 |
Incorrect |
33 ms |
1276 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |