This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N, M;
cin >> N >> M;
vector<int> Tab(N, -1);
int tot = 0, last = 0;
for (int i = 1; i <= M; i++)
{
int x;
cin >> x;
if (x > 0)
{
if (Tab[x] >= last)
{
last = i;
tot++;
}
Tab[x] = i;
}
else
{
Tab[-x] = -1;
}
}
cout << tot;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |