답안 #972961

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
972961 2024-05-01T10:53:41 Z Unforgettablepl 가로등 (APIO19_street_lamps) C++17
20 / 100
133 ms 4576 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

bool state[101];
int ans[101][101];

void compute(){
    for(int start = 1;start<=100;start++){
        for(int end = start;end<=100;end++){
            if(!state[end])break;
            ans[start][end]++;
        }
    }
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,q;
    cin >> n >> q;
    for(int i=1;i<=n;i++){
        char a;cin>>a;
        if(a=='1')state[i]=true;
    }
    for(int i=1;i<=q;i++){
        compute();
        string type;cin>>type;
        if(type=="toggle"){
            int x;cin>>x;
            state[x] = !state[x];
        } else {
            int l,r;cin>>l>>r;
            cout << ans[l][r-1] << '\n';
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 133 ms 4576 KB Output is correct
2 Runtime error 1 ms 600 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 133 ms 4576 KB Output is correct
9 Runtime error 1 ms 600 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -