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>
using namespace std;
int main(){
int n, q, ans = 0; cin >> n >> q;
unordered_map<int,int> overtake;
while(q--){
int x; cin >> x;
int X = abs(x);
if(x>0 and overtake[X]==1)
ans++, overtake.clear(), overtake[X]=1;
else overtake[X]=(x>0)?1:-1;
}
cout << ans << "\n";
}
# | 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... |