Submission #1790686
Source Code Expand
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int i, ret, x, ans; int[] cre = {-1, 1}; int N = Integer.parseInt(br.readLine()); String[] array = br.readLine().split(""); x = ans = 0; for (String Si: array) { ret = Si.equals("I") ? 1 : 0; x += cre[ret]; ans = Math.max(x, ans); } System.out.println(ans); } }
Submission Info
Submission Time | |
---|---|
Task | B - Increment Decrement |
User | pytry3g |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 581 Byte |
Status | AC |
Exec Time | 73 ms |
Memory | 21076 KB |
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 | 71 ms | 19284 KB |
sample_02.txt | AC | 68 ms | 17620 KB |
subtask_1_alld_01.txt | AC | 72 ms | 16084 KB |
subtask_1_alldmax_01.txt | AC | 72 ms | 19280 KB |
subtask_1_alli_01.txt | AC | 70 ms | 20692 KB |
subtask_1_allimax_01.txt | AC | 72 ms | 20180 KB |
subtask_1_max_01.txt | AC | 73 ms | 21076 KB |
subtask_1_max_02.txt | AC | 73 ms | 20948 KB |
subtask_1_rand_01.txt | AC | 73 ms | 19284 KB |
subtask_1_rand_02.txt | AC | 72 ms | 21072 KB |