Submission #1591012
Source Code Expand
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0; i < (int)(n); ++i) #define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i) #define ALL(x) (x).begin(), (x).end() #define INF 2000000000 #ifdef LOCAL #define eprintf(...) fprintf(stdout, __VA_ARGS__) #else #define eprintf(...) 0 #endif using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef unsigned int uint; int main() { int n; string s; cin >> n >> s; int x = 0; int mx = x; REP(i, n) { if(s[i] == 'I') { x++; } else { x--; } mx = max(mx, x); } cout << mx << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Increment Decrement |
User | yoshi_k |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 666 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 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 | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
subtask_1_alld_01.txt | AC | 1 ms | 256 KB |
subtask_1_alldmax_01.txt | AC | 1 ms | 256 KB |
subtask_1_alli_01.txt | AC | 1 ms | 256 KB |
subtask_1_allimax_01.txt | AC | 1 ms | 256 KB |
subtask_1_max_01.txt | AC | 1 ms | 256 KB |
subtask_1_max_02.txt | AC | 1 ms | 256 KB |
subtask_1_rand_01.txt | AC | 1 ms | 256 KB |
subtask_1_rand_02.txt | AC | 1 ms | 256 KB |