Submission #798583

# Submission time Handle Problem Language Result Execution time Memory
798583 2023-07-30T21:04:01 Z gg123_pe Street Lamps (APIO19_street_lamps) C++14
20 / 100
1 ms 468 KB
#include <bits/stdc++.h> 
using namespace std; 

#define f(i,a,b) for(int i = a; i < b; i++)
const int N = 3e5 + 5, M = 105;

int n, q; 
int a[M][M]; 
string s; 

void subtask_1(){
    f(i,1,q+1){
        f(j,1,n+1) a[i][j] = a[i-1][j]; 
        string ty; 
        int x, y;

        cin >> ty; 
        if(ty[0] == 'q'){
            cin >> x >> y; 
            // cuantos tiempos el rango [x, y-1] suma 0
            int ans = 0; 
            f(j,0,i){
                int sum = 0; 
                f(r,x,y) sum += a[j][r]; 
                if(sum == 0) ans++; 
            }
            cout << ans << "\n"; 
        }
        else{
            cin >> x; 
            a[i][x] = 1 - a[i][x]; 
        }
    }
}
int main(){
    cin >> n >> q; 

    cin >> s; 
    f(i,0,n){
        if(s[i] == '0') a[0][i+1] = 1; 
        else a[0][i+1] = 0; 
    }

    if(n <= 100){
        subtask_1(); 
        return 0; 
    }
    
    return 0; 
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Runtime error 1 ms 468 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -