Submission #1442207
Source Code Expand
#include <cstdio> int main() { int n, rez = 0, maxx = 0; scanf("%d", &n); char ch = fgetc(stdin); for (int i = 1; i <= n; i++) { char ch = fgetc(stdin); if (ch == 'I') { rez++; } else { rez--; } if (rez >= maxx) maxx = rez; } printf("%d", maxx); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Increment Decrement |
User | FizZ |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 395 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:7:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^
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 | 0 ms | 128 KB |
sample_02.txt | AC | 1 ms | 128 KB |
subtask_1_alld_01.txt | AC | 0 ms | 128 KB |
subtask_1_alldmax_01.txt | AC | 0 ms | 128 KB |
subtask_1_alli_01.txt | AC | 0 ms | 128 KB |
subtask_1_allimax_01.txt | AC | 0 ms | 128 KB |
subtask_1_max_01.txt | AC | 0 ms | 128 KB |
subtask_1_max_02.txt | AC | 0 ms | 128 KB |
subtask_1_rand_01.txt | AC | 0 ms | 128 KB |
subtask_1_rand_02.txt | AC | 0 ms | 128 KB |