Submission #3570955
Source Code Expand
int main() { int maxval; int i; scanf("%d", &i); i++; char string[i]; for(int counter = 0; counter < (i); counter++) { scanf("%c", &string[counter]); } int val = 0; for (int j = 0; j < i; j++) { if(string[j] == 'I') { val++; if(val >= maxval) { maxval = val; } } else if (string[j] == 'D') { val--; if(val >= maxval) { maxval = val; } } } printf("%d\n", maxval); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Increment Decrement |
User | vjudge3 |
Language | C (GCC 5.4.1) |
Score | 200 |
Code Size | 615 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:5:5: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] scanf("%d", &i); ^ ./Main.c:5:5: warning: incompatible implicit declaration of built-in function ‘scanf’ ./Main.c:5:5: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ ./Main.c:32:5: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] printf("%d\n", maxval); ^ ./Main.c:32:5: warning: incompatible implicit declaration of built-in function ‘printf’ ./Main.c:32:5: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt |
All | sample_01.txt, sample_02.txt, subtask_1_alld_01.txt, subtask_1_alldmax_01.txt, subtask_1_alli_01.txt, subtask_1_allimax_01.txt, subtask_1_max_01.txt, subtask_1_max_02.txt, subtask_1_rand_01.txt, subtask_1_rand_02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 128 KB |
sample_02.txt | AC | 1 ms | 128 KB |
subtask_1_alld_01.txt | AC | 1 ms | 128 KB |
subtask_1_alldmax_01.txt | AC | 1 ms | 128 KB |
subtask_1_alli_01.txt | AC | 1 ms | 128 KB |
subtask_1_allimax_01.txt | AC | 1 ms | 128 KB |
subtask_1_max_01.txt | AC | 1 ms | 128 KB |
subtask_1_max_02.txt | AC | 1 ms | 128 KB |
subtask_1_rand_01.txt | AC | 1 ms | 128 KB |
subtask_1_rand_02.txt | AC | 1 ms | 128 KB |