Submission #1260056

#TimeUsernameProblemLanguageResultExecution timeMemory
1260056zertiniiInfinite Race (EGOI24_infiniterace2)C++20
0 / 100
9 ms1864 KiB
//#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 + 1, 0);
    int kol = 0;
    for(int i = 0;i < m;i++) {
        int x;
        cin >> x;
        if(x > 0) {
            if(a[x] == -1) {
                kol++;
            }
            a[x] = -1;
        }
        else {
            if(a[-x] == 1) {
                kol++;
            }
            a[x] = 1;
        }
    }
    cout << kol;
}
signed main() {
    ios;
    int t = 1;
    //cin >> t;
    while(t--) {
        tin();
    }
    stop;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...