Submission #1094899

#TimeUsernameProblemLanguageResultExecution timeMemory
1094899raphaelpInfinite Race (EGOI24_infiniterace2)C++14
100 / 100
42 ms2644 KiB
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> Tab(N, -1); int tot = 0, last = 0; for (int i = 1; i <= M; i++) { int x; cin >> x; if (x > 0) { if (Tab[x] >= last) { last = i; tot++; } Tab[x] = i; } else { Tab[-x] = -1; } } cout << tot; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...