Submission #52863361
Source Code Expand
#include <stdio.h>
int main(){
int N;
scanf("%d", &N);
long long A[N+1];
for(int i = 1; i <= N; i++){
scanf("%lld", &A[i]);
}
int balls = 0;
long long ball_arr[N+1];
for(int i = 0; i <= N; i++){
ball_arr[i] = 0;
}
for(int i = 1; i <= N; i++){
balls++;
ball_arr[balls] = A[i];
int flag = 1;
while(flag){
//rule1
if(balls == 1){
// for(int i = 1; i <= N; i++){
// printf("%lld ", ball_arr[i]);
// }
// printf("\n");
flag = 0;
continue;
}
//rule2
if(ball_arr[balls] != ball_arr[balls - 1]){
// for(int i = 1; i <= N; i++){
// printf("%lld ", ball_arr[i]);
// }
// printf("\n");
flag = 0;
continue;
} else {
//rule3
ball_arr[balls - 1]++;
ball_arr[balls] = 0;
balls--;
}
// for(int i = 1; i <= N; i++){
// printf("%lld ", ball_arr[i]);
// }
// printf("\n");
}
}
printf("%d\n", balls);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Merge the balls |
| User | oinucha |
| Language | C (gcc 12.2.0) |
| Score | 250 |
| Code Size | 1363 Byte |
| Status | AC |
| Exec Time | 20 ms |
| Memory | 4860 KiB |
Compile Error
Main.c: In function ‘main’:
Main.c:5:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d", &N);
| ^~~~~~~~~~~~~~~
Main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%lld", &A[i]);
| ^~~~~~~~~~~~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 250 / 250 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt, example_01.txt |
| All | example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 0 ms | 1708 KiB |
| example_01.txt | AC | 0 ms | 1616 KiB |
| hand_00.txt | AC | 16 ms | 4744 KiB |
| hand_01.txt | AC | 11 ms | 3656 KiB |
| hand_02.txt | AC | 11 ms | 3756 KiB |
| hand_03.txt | AC | 14 ms | 4760 KiB |
| hand_04.txt | AC | 13 ms | 4720 KiB |
| hand_05.txt | AC | 14 ms | 4840 KiB |
| hand_06.txt | AC | 14 ms | 4844 KiB |
| hand_07.txt | AC | 0 ms | 1560 KiB |
| hand_08.txt | AC | 1 ms | 1592 KiB |
| hand_09.txt | AC | 0 ms | 1588 KiB |
| hand_10.txt | AC | 0 ms | 1640 KiB |
| random_00.txt | AC | 17 ms | 4756 KiB |
| random_01.txt | AC | 16 ms | 4856 KiB |
| random_02.txt | AC | 16 ms | 4856 KiB |
| random_03.txt | AC | 16 ms | 4832 KiB |
| random_04.txt | AC | 17 ms | 4820 KiB |
| random_05.txt | AC | 16 ms | 4856 KiB |
| random_06.txt | AC | 16 ms | 4720 KiB |
| random_07.txt | AC | 16 ms | 4836 KiB |
| random_08.txt | AC | 16 ms | 4832 KiB |
| random_09.txt | AC | 16 ms | 4740 KiB |
| random_10.txt | AC | 17 ms | 4712 KiB |
| random_11.txt | AC | 17 ms | 4852 KiB |
| random_12.txt | AC | 16 ms | 4696 KiB |
| random_13.txt | AC | 16 ms | 4856 KiB |
| random_14.txt | AC | 16 ms | 4744 KiB |
| random_15.txt | AC | 16 ms | 4836 KiB |
| random_16.txt | AC | 16 ms | 4844 KiB |
| random_17.txt | AC | 18 ms | 4860 KiB |
| random_18.txt | AC | 17 ms | 4832 KiB |
| random_19.txt | AC | 17 ms | 4840 KiB |
| random_20.txt | AC | 18 ms | 4712 KiB |
| random_21.txt | AC | 18 ms | 4848 KiB |
| random_22.txt | AC | 19 ms | 4844 KiB |
| random_23.txt | AC | 19 ms | 4820 KiB |
| random_24.txt | AC | 20 ms | 4716 KiB |