이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |