제출 #1354826

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

using ll = long long;

int n,q;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> n >> q;
	set<int>overt;

	int ans = 0;
	while(q--){
		int x; cin >> x;
		if(x > 0){
			if(overt.find(x) != overt.end()){
				ans++;
				overt.clear();
			}
			overt.insert(x);
		}
		else {
			x *= -1;
			if(overt.find(x) != overt.end()) overt.erase(x);
		}
	}
	cout<<ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...