# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
433688 | 2021-06-20T09:31:04 Z | JeanBombeur | 가로등 (APIO19_street_lamps) | C++17 | 255 ms | 19312 KB |
#include <iostream> #include <cstdio> #include <vector> using namespace std; // <|°_°|> const int MAX_LAMPES = (300 * 1000); bool State[MAX_LAMPES]; char Mot[MAX_LAMPES + 1]; vector <int> Dates[MAX_LAMPES]; int nbLampes, nbRequetes; void Read() { scanf("%d %d", &nbLampes, &nbRequetes); scanf("%s", Mot); for (int i = 0; i < nbLampes; i ++) { State[i] = Mot[i] == '1'; Dates[i].push_back(0); } return; } void Solve() { for (int i = 1; i <= nbRequetes; i ++) { int a, b; scanf("%s %d", Mot, &a); a --; Dates[a].push_back(i); if (Mot[0] == 'q') { scanf("%d", &b); b --; int sz = (int)Dates[a].size(); int ans = 0; int deb = 1; if (!State[a]) deb ++; for (; deb < sz; deb += 2) { ans += Dates[a][deb] - Dates[a][deb - 1]; } printf("%d\n", ans); if (!State[a]) ans = i - ans; Dates[a].clear(); Dates[a].push_back(0); Dates[a].push_back(ans); if (!(sz & 1)) Dates[a].push_back(i); } } return; } int main() { Read(); Solve(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 7244 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 96 ms | 8244 KB | Output is correct |
2 | Correct | 100 ms | 8232 KB | Output is correct |
3 | Correct | 114 ms | 8692 KB | Output is correct |
4 | Correct | 210 ms | 18348 KB | Output is correct |
5 | Correct | 231 ms | 18556 KB | Output is correct |
6 | Correct | 215 ms | 18020 KB | Output is correct |
7 | Correct | 234 ms | 17848 KB | Output is correct |
8 | Correct | 255 ms | 19312 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 7372 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 7372 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 7244 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |