Submission #947724

# Submission time Handle Problem Language Result Execution time Memory
947724 2024-03-16T23:37:01 Z Volvox123 JOIOJI (JOI14_joioji) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h> 
#define int long long
using namespace std;
unordered_map<int, int> counter; int n; string poem; 
signed main(){
    cin >> n;
cin >> poem;
 
   
    int max_length = 0;
    counter[0] = -1; 
    int diff = 0;
    for (int i = 0; i < n; i++) {
        if (poem[i] == 'J') {
            diff++;
        } else if (poem[i] == 'O') {
            diff--;
        }
 
        if (counter.find(diff) != counter.end()) {
            max_length = max(max_length, i - counter[diff]);
        } else {
            counter[diff] = i;
        }
    }
 
    cout << max_length << endl;
 
    return 0;
}

Compilation message

joioji.cpp:6:2: error: extended character   is not valid in an identifier
    6 |     cin >> n;
      |  ^
joioji.cpp:6:5: error: extended character   is not valid in an identifier
    6 |     cin >> n;
      |    ^
joioji.cpp: In function 'int main()':
joioji.cpp:6:2: error: '\U000000a0' was not declared in this scope
    6 |     cin >> n;
      |  ^