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 endl "\n"
#define rep(N) for(int i=0;i<N;++i)
#define ll long long
#define int long long
#define pi pair<int,int>
#define vi vector<int>
//#define F first
//#define S second
#define gotta_go_fast cin.tie(0); ios_base::sync_with_stdio(0);
// EGOI 2024 D1 Q1 Infinite Race
signed main() {
gotta_go_fast
int N, Q;
cin >> N >> Q;
vi pos(N, -1);
int laps = 0;
rep(Q) {
int P;
cin >> P;
if (P > 0) {
if (pos[P] == laps) {
laps++;
pos[P] = laps;
} else pos[P] = laps;
} else pos[-1 * P] = -1;
}
cout << laps;
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... |