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>
#define ss second
#define pb push_back
#define mod 1000000007
#define N 200005
#define INF 1000000000000000005
#define pu push
#define ff first
#define pint pair<int,int>
typedef long long ll;
using namespace std;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
int t;
cin>>t;
bool take[n];
int cnt[n];
memset(cnt,0,sizeof(cnt));
memset(take,false,sizeof(take));
while(t--)
{
int a;
cin>>a;
if(a>0)
{
if(take[a])
cnt[a]++;
else
take[a]=true;
}
else
take[-a]=false;
}
int ans=0;
for(int i=1;i<n;i++)
ans=max(ans,cnt[i]);
cout<<ans<<endl;
return 0;
}
# | 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... |