#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define mod 1000000007
#define sp << " " <<
#define endl << '\n'
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int N, Q;
cin >> N >> Q;
vector<int> part(N);
int ret = 1;
for (int i = 0; i < Q; i++){
long long int K;
cin >> K;
if (K < 0){
part[-K] = max(0, part[-K] - 1);
}else{
part[K]++;
ret = max(ret, part[K]);
}
}
cout << ret - 1;
}
# | 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... |