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;
# define int long long
void solve()
{
map < int , int > mp;
int n, q, mx = -1;
bool flag = 0;
cin >> n >> q;
while(q--)
{
int x;
cin >> x;
if(x < 0)
{
mp[abs(x)]--;
flag = 1;
}
else
mp[x]++;
}
for(int i = 1; i <= n; i++)
{
mx = max(mx, mp[i]);
}
if(!flag)
mx--;
if(mx < 0)
mx = 0;
cout << mx << endl;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tt = 1;
// cin >> tt;
while(tt--){
solve();
}
}
# | 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... |