# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1070443 | matthew | Infinite Race (EGOI24_infiniterace2) | C++17 | 69 ms | 11028 KiB |
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 <stdio.h>
#include <set>
const int MAXN = 200'000;
std::set<int> spate; // cine e in spatele meu
void solveTest() {
int n, q, i, rez, a;
scanf("%d%d", &n, &q);
rez = 0;
for(i = 0; i < q; i++) {
scanf("%d", &a);
if(a > 0) {
if(spate.find(a) != spate.end()) { // am facut o tura
rez++;
// ne cere nr minim de ture deci worst case toti vor fi in fata
// mai putin asta pe care l-am intrecut
spate.clear();
}
spate.insert(a);
} else {
spate.erase(-a);
}
}
printf("%d\n", rez);
}
int main() {
int t, i;
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
t = 1;
//scanf("%d", &t);
for(i = 0; i < t; i++) {
#ifdef LOCAL
printf("====== Test %d ======\n", i + 1);
#endif
solveTest();
#ifdef LOCAL
printf("\n\n");
#endif
}
return 0;
}
Compilation message (stderr)
# | 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... |