Submission #2382250
Source Code Expand
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; } template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; } template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; } template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; } /* <url:> 問題文============================================================ ================================================================= 解説============================================================= ================================================================ */ int main(void) { cin.tie(0); ios_base::sync_with_stdio(false); ll N; cin >> N; string S; cin >> S; ll M = 0; ll x = 0; for(int i = 0; i < S.length();i++){ if(S[i] == 'I'){ x++; M = max(M,x); }else{ x--; } } cout << M << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Increment Decrement |
User | vjudge3 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1530 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 |