Submission #1241268
Source Code Expand
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <stack> #include <queue> #include <cctype> #define rep(i, m, n) for(int i = m;i < n;i++) #define repr(i, n) for(int i = n;i >= 0;i--) #define ll long long #define ull unsigned long long #define push(a) push_back(a) #define pop(a) pop_back(a) #define debug(x) cout<<#x<<": "<<x<<endl #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define INF 999999999 using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; typedef pair<int, P> PP; typedef pair<ll, LP> LPP; int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; int main(){ int n, x, x_max=0; string s; cin >> n >> s; rep(i,0,n){ if(s[i] == 'I'){ x++; }else if(s[i] == 'D'){ x--; } x_max = max(x_max, x); } cout << x_max << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Increment Decrement |
User | thedekopin0108 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 896 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 |