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>
//#define ll long long
using namespace std;
int main()
{
int n, q; cin >> n >> q;
vector <int> pre(n, -1);
int tren=0;
while(q--)
{
int x; cin >> x;
if (x>0)
{
if (pre[x]!=tren) pre[x]=tren;
else
{
tren++;
pre[x]=tren;
}
}
else
{
x*=(-1);
pre[x]=(-1);
}
}
cout << tren << endl;
return 0;
}
# | 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... |