제출 #1341112

#제출 시각아이디문제언어결과실행 시간메모리
1341112aykhnInfinite Race (EGOI24_infiniterace2)C++20
100 / 100
66 ms9832 KiB
#include <bits/stdc++.h>
 
using namespace std;

#define inf 0x3F3F3F3F3F3F3F3F
#define int long long
#define bpc __builtin_popcountll

const int mod = 998244353;
const int MXN = 1e3 + 5;

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, q, res = 0;
	cin >> n >> q;
	set<int> b;
	while (q--)
	{
		int x;
		cin >> x;
		if (x > 0)
		{
			if (b.find(x) != b.end()) res++, b.clear();
			b.insert(x);
		}
		else
		{
			if (b.find(-x) != b.end()) b.erase(-x);
		}
	}
	cout << res << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...