Submission #947719

#TimeUsernameProblemLanguageResultExecution timeMemory
947719Volvox123JOIOJI (JOI14_joioji)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>using namespace std;int main() {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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:2:31: warning: extra tokens at end of #include directive
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                               ^~~~~~~~~
joioji.cpp:2:59: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                           ^
joioji.cpp:2:62: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                             ^
joioji.cpp:2:71: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                     ^
joioji.cpp:2:74: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                       ^
joioji.cpp:2:86: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                  ^
joioji.cpp:2:89: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                    ^
joioji.cpp:2:104: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                  ^
joioji.cpp:2:107: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                    ^
joioji.cpp:2:122: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                  ^
joioji.cpp:2:125: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                    ^
joioji.cpp:2:151: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                             ^
joioji.cpp:2:154: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                               ^
joioji.cpp:2:176: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                                                    ^
joioji.cpp:2:179: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                                                      ^
joioji.cpp:2:198: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                                                                        ^
joioji.cpp:2:201: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                                                                          ^
joioji.cpp:2:218: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                                                                                          ^
joioji.cpp:2:221: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                                                                                            ^
joioji.cpp:2:253: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                                                                                                                           ^
joioji.cpp:2:256: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                                                                                                                             ^
joioji.cpp:2:259: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                                                                                                                               ^
joioji.cpp:2:262: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                                                                                                                                 ^
joioji.cpp:2:286: error: extended character   is not valid in an identifier
    2 | #include <bits/stdc++.h>using namespace std;int main()  {    int n;    cin >> n;    string poem;    cin >> poem;     map<int, int> counter;    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;}
      |                                                                                                                                                                                                                                                                        ^
joioji.cpp:2:289: erro