# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1148209 | Muhammad_Aneeq | Infinite Race (EGOI24_infiniterace2) | C++20 | 65 ms | 9800 KiB |
/*
بسم الله الرحمن الرحيم
Author:
(:Muhammad Aneeq:)
*/
#include <iostream>
#include <set>
#warning check the output
using namespace std;
inline void solve()
{
int n,q;
cin>>n>>q;
set<int>s;
int ans=0;
while (q--)
{
int x;
cin>>x;
if (x>0)
{
if (s.find(x)==s.end())
s.insert(x);
else
{
s={};
s.insert(x);
ans++;
}
}
else
{
x=-x;
s.erase(x);
}
}
cout<<ans<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int t=1;
for (int i=1;i<=t;i++)
{
solve();
}
}
Compilation message (stderr)
# | 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... |