Submission #503100

# Submission time Handle Problem Language Result Execution time Memory
503100 2022-01-07T08:53:52 Z stefantaga Street Lamps (APIO19_street_lamps) C++14
20 / 100
106 ms 11660 KB
#include <bits/stdc++.h>

using namespace std;
int v[300005],n,q,x,y,ult[300005],nr[300005],i,j,t;
int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    #ifdef HOME
    ifstream cin("date.in");
    ofstream cout("date.out");
    #endif // HOME
    cin>>n>>q;
    for (i=1;i<=n;i++)
    {
        char ch;
        cin>>ch;
        v[i]=ch-'0';
        nr[i]=v[i];
        ult[i]=1;
    }
    for (i=1;i<=q;i++)
    {
        char tip[15];
        cin>>tip;
        if (strcmp(tip,"query")==0)
        {
            cin>>x>>y;
            if (v[x]==1)
            {
                cout<<nr[x]+i-ult[x]<<'\n';
            }
            else
            cout<<nr[x]<<'\n';
        }
        else
        {
            cin>>x;
            if (v[x]==1)
            {
                nr[x]=nr[x]+i-ult[x];
            }
            ult[x]=i;
            v[x]=1-v[x];
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 55 ms 4416 KB Output is correct
2 Correct 60 ms 4736 KB Output is correct
3 Correct 63 ms 5316 KB Output is correct
4 Correct 83 ms 9568 KB Output is correct
5 Correct 96 ms 9996 KB Output is correct
6 Correct 79 ms 9412 KB Output is correct
7 Correct 102 ms 10248 KB Output is correct
8 Correct 106 ms 11660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -