제출 #1236206

#제출 시각아이디문제언어결과실행 시간메모리
1236206elenatrifInfinite Race (EGOI24_infiniterace2)C++20
29 / 100
85 ms9796 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, q; cin >> n >> q; set<int> behind; int cnt = 0; for (int i = 0; i < q; ++i) { int x; cin >> x; int id = abs(x); if (x > 0) { // Anika overtakes id if (behind.count(id)) { // Already behind → must be a lap cnt++; } else { // First time putting this guy behind behind.insert(id); } } else { // Someone overtakes Anika → they are ahead now behind.erase(id); } } cout << cnt << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...