# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1070443 | matthew | Infinite Race (EGOI24_infiniterace2) | C++17 | 69 ms | 11028 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (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... |