Submission #700697

# Submission time Handle Problem Language Result Execution time Memory
700697 2023-02-19T08:20:21 Z coding_snorlax Street Lamps (APIO19_street_lamps) C++14
20 / 100
2 ms 468 KB
#include<bits/stdc++.h>
using namespace std;
int List[105][105];
int main(){
    int N,Q;
    cin>>N>>Q;
    for(int i=1;i<=N;i++){
        char s;
        cin>>s;
        List[0][i]=s-'0';
    }
    int sp=-1;
    for(int i=1;i<=Q;i++){
        string s;
        int a,b;
        cin>>s;
        for(int j=1;j<=N;j++){
            List[i][j]=List[i-1][j];
        }
        if(sp!=-1) List[i-1][sp]=1-List[i-1][sp];
        if(s=="query"){
            sp = -1;
            cin>>a>>b;
            int answer = 0;
            for(int j=1;j<=i;j++){
                int flag = 1;
                for(int k=a;k<b;k++){
                    if(!List[j][k]) flag = 0;
                }
                answer += flag;
            }
            cout << answer << "\n";
        }
        else{
            cin>>a;
            List[i][a]=1-List[i][a];
            sp = a;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 264 KB Output is correct
7 Correct 2 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 436 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 444 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 264 KB Output is correct
7 Correct 2 ms 304 KB Output is correct
8 Runtime error 2 ms 468 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -