Submission #971855

# Submission time Handle Problem Language Result Execution time Memory
971855 2024-04-29T12:05:58 Z vivkostov Street Lamps (APIO19_street_lamps) C++14
0 / 100
13 ms 24668 KB
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    /*#ifdef ONLINE_JUDGE
    freopen("taxi.in", "r", stdin);
    freopen("taxi.out", "w", stdout);
    #endif
    */
}
int n,q;
string s[305];
string a[300005];
int l[300005],r[300005];
int answer(int l,int r,int ti)
{
    l--;
    r--;
    int br=0;
    for(int i=0;i<ti;i++)
    {
        for(int j=l;j<=r;j++)
        {
            if(s[i][j-1]=='0')break;
            if(j==r)br++;
        }
    }
    return br;
}
void read()
{
    cin>>n>>q>>s[0];
    for(int i=1;i<=q;i++)
    {
        cin>>a[i]>>l[i];
        s[i]=s[i-1];
        if(a[i]=="query")
        {
            cin>>r[i];
            cout<<answer(l[i],r[i],i)<<endl;
        }
        else
        {
            s[i][l[i]-1]++;
            if(s[i][l[i]-1]=='2')s[i][l[i]-1]='0';
        }
    }
}
int main()
{
    speed();
    read();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 11864 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 23960 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 24536 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 24668 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 11864 KB Output isn't correct
2 Halted 0 ms 0 KB -