Submission #1238578

#TimeUsernameProblemLanguageResultExecution timeMemory
1238578JerInfinite Race (EGOI24_infiniterace2)C++20
29 / 100
12 ms1348 KiB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 2e5 + 5;
int laps[MAXN];
bool ahead[MAXN];

int n, q;

int main()
{
    scanf("%d%d", &n, &q);
    fill(laps, laps + n, 0);

    int a, res = 0;
    while (q--)
    {
        scanf("%d", &a);
        if (a > 0)
            laps[a] += (ahead[a]), ahead[a] = true, res = max(res, laps[a]);
        else
            ahead[-a] = false;
    }

    printf("%d\n", res);

    return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d%d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         scanf("%d", &a);
      |         ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...