//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
#include <bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define yes cout << "YES" << '\n'
#define no cout << "NO" << '\n'
#define stop return 0
#define str string
#define int long long
#define veci vector<int>
#define skip continue
#define sz size()
#define pii pair<int,int>
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 5;
const int inf = 1e9 + 7;
int b[N];
int dp[N];
int n, m;
str s;
void tin() {
cin >> n >> m;
veci a(n, 0);
int kol = 0;
int kol1 = 1;
for(int i = 0;i < m;i++) {
int x;
cin >> x;
int x1 = abs(x);
if(a[x1] == kol1) {
kol++;
kol1++;
}
a[x1] = kol1;
}
cout << kol;
}
signed main() {
ios;
int t = 1;
//cin >> t;
while(t--) {
tin();
}
stop;
}
# | 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... |