Submission #947722

#TimeUsernameProblemLanguageResultExecution timeMemory
947722Volvox123JOIOJI (JOI14_joioji)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; unordered_map<int, int> counter; int main()   { int n; cin >> n; string poem; 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 (stderr)

joioji.cpp:4:12: error: extended character   is not valid in an identifier
    4 | int main()  
      |            ^
joioji.cpp:11:2: error: extended character   is not valid in an identifier
   11 |   
      |  ^
joioji.cpp:12:2: error: extended character   is not valid in an identifier
   12 |     int max_length = 0;
      |  ^
joioji.cpp:4:12: error: expected initializer before '\U000000a0'
    4 | int main()  
      |            ^