Submission #938688

# Submission time Handle Problem Language Result Execution time Memory
938688 2024-03-05T12:35:16 Z Andreibatman Street Lamps (APIO19_street_lamps) C++14
20 / 100
302 ms 4956 KB
#include <bits/stdc++.h>
using namespace std;
int n,q,i,j,ok,x,y;
char sir[300010],op[30];
int mat[110][110];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>q>>(sir+1);
    for(i=1; i<=n; i++)
    {
        ok=1;
        for(j=i+1; j<=n+1; j++)
            if(sir[j-1]=='0')
                break;
            else
                mat[i][j]++;
    }

    while(q--)
    {
        cin>>op>>x;
        if(op[0]=='t')
        {
            if(sir[x]=='0')
                sir[x]='1';
            else
                sir[x]='0';
        }
        else
        {
            cin>>y;
            cout<<mat[x][y]<<'\n';
        }
        for(i=1; i<=n; i++)
        {
            ok=1;
            for(j=i+1; j<=n+1; j++)
                if(sir[j-1]=='0')
                    break;
                else
                    mat[i][j]++;
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 464 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 146 ms 4600 KB Output is correct
2 Incorrect 302 ms 4956 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1116 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 464 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 146 ms 4600 KB Output is correct
9 Incorrect 302 ms 4956 KB Output isn't correct
10 Halted 0 ms 0 KB -