Submission #974710

# Submission time Handle Problem Language Result Execution time Memory
974710 2024-05-03T16:45:48 Z Abito Street Lamps (APIO19_street_lamps) C++17
20 / 100
1 ms 856 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
//#define int long long
#define ll long long
typedef unsigned long long ull;
using namespace std;
const int N=105+5;
int n,q;
bool a[N][N];
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin>>n>>q;
    for (int i=1;i<=n;i++){
        char c;cin>>c;
        if (c=='1') a[0][i]=1;
    }
    for (int i=1;i<=q;i++){
        for (int j=1;j<=n;j++) a[i][j]=a[i-1][j];
        string s;
        cin>>s;
        if (s=="toggle"){
            int x;cin>>x;
            a[i][x]=!a[i][x];
            continue;
        }
        int l,r,ans=0;cin>>l>>r;
        for (int j=0;j<i;j++){
            bool ok=true;
            for (int k=l;k<r;k++) ok&=a[j][k];
            ans+=ok;
        }
        cout<<ans<<endl;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 456 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 460 KB Output is correct
7 Correct 0 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 856 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 472 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 456 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 460 KB Output is correct
7 Correct 0 ms 460 KB Output is correct
8 Runtime error 1 ms 856 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -