| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 406683 | tengiz05 | 가로등 (APIO19_street_lamps) | C++17 | 132 ms | 10968 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, q;
std::cin >> n >> q;
std::string v;
std::cin >> v;
std::vector<int> last(n, -1), ans(n);
for (int it = 0; it < q; it++) {
std::string type;
std::cin >> type;
if (type == "query") {
int l, r;
std::cin >> l >> r;
l--;
r-=2;
int res = ans[l];
if (v[l] == '1') res += (it - last[l]);
std::cout << res << "\n";
} else {
int p;
std::cin >> p;
p--;
if (v[p] == '1') {
ans[p] += it - last[p];
} else {
last[p] = it;
}
v[p] ^= 1;
}
}
}| # | 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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
