Submission #1750758


Source Code Expand

#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(void) {
    int n,m,x;
    string s;
    cin >> n >> s;
    m = x = 0;
    REP(i,n){
        if(n[i]=="I"){
            x++;
            if (x > m) m = x;
        } else {
            X--;
        }
    }
    cout << m;
    return 0;
}

Submission Info

Submission Time
Task B - Increment Decrement
User V_Melville
Language C++14 (GCC 5.4.1)
Score 0
Code Size 700 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:22:15: error: invalid types ‘int[int]’ for array subscript
         if(n[i]=="I"){
               ^
./Main.cpp:26:13: error: ‘X’ was not declared in this scope
             X--;
             ^