제출 #1148209

#제출 시각아이디문제언어결과실행 시간메모리
1148209Muhammad_AneeqInfinite Race (EGOI24_infiniterace2)C++20
100 / 100
65 ms9800 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();
    }
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp:9:2: warning: #warning check the output [-Wcpp]
    9 | #warning check the output
      |  ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...