제출 #1367039

#제출 시각아이디문제언어결과실행 시간메모리
1367039Nxmkxing가로등 (APIO19_street_lamps)C++20
0 / 100
1 ms580 KiB
#include <bits/stdc++.h>
using namespace std;

const int N = 110;
int n, q;
string s[N];

int main() {
    cin.tie(nullptr)->ios_base::sync_with_stdio(false);
    cin >> n >> q >> s[0];
    for (int i = 1; i <= q; i++) {
        s[i] = s[i-1];
        string type;
        cin >> type;
        if (type == "toggle") {
            int pos;
            cin >> pos; pos--;
            s[i][pos] = '1' + '0' - s[i][pos];
        }
        else {
            int a, b;
            cin >> a >> b; a--, b--;
            int total = 0;
            for (int j = 1; j < i; j++) {
                bool ok = true;
                for (int k = a; k < b; k++) {
                    if (s[j][k] == '0') ok = false;
                }
                total += ok;
            }
            cout << total << "\n";
        }
    }
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…