#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();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Incorrect |
11 ms |
940 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
504 KB |
Output is correct |
2 |
Correct |
7 ms |
848 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
73 ms |
14064 KB |
Output is correct |
6 |
Correct |
41 ms |
12880 KB |
Output is correct |
7 |
Incorrect |
9 ms |
848 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
504 KB |
Output is correct |
4 |
Incorrect |
1 ms |
592 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Incorrect |
11 ms |
940 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |