Submission #1338443

#TimeUsernameProblemLanguageResultExecution timeMemory
1338443vjudge1Infinite Race (EGOI24_infiniterace2)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, q, diff, maxi;
    cin >> n >> q;
    diff = maxi = 0;
    for( i = 1; i <= q; i++ ) {
        cin >> x;
        if( x > 0 )
            diff++;
        else
            diff--;
        maxi = max( maxi, diff );
    }
    cout << max( 0, maxi - 1 );
    return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:9:10: error: 'i' was not declared in this scope
    9 |     for( i = 1; i <= q; i++ ) {
      |          ^
Main.cpp:10:16: error: 'x' was not declared in this scope
   10 |         cin >> x;
      |                ^