Submission #142964

# Submission time Handle Problem Language Result Execution time Memory
142964 2019-08-12T12:31:23 Z JovanK26 Street Lamps (APIO19_street_lamps) C++14
20 / 100
5000 ms 48320 KB
#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    int a[n][q];
    for(int i=0;i<n;i++)
    {
        a[i][0]=s[i]-'0';
    }
    string qry;
    int l,r;
    int t;
    for(int i=1;i<=q;i++)
    {
        cin >> qry;
        if(qry=="toggle")
        {
            cin >> t;
            for(int j=0;j<n;j++)
            {
                a[j][i]=a[j][i-1];
            }
            a[t-1][i]^=1;
        }
        else
        {
            cin >> l >> r;
            long long rez=0;
            for(int time=0;time<i;time++)
            {
                bool check=0;
                for(int j=l-1;j<r-1;j++)
                {
                    if(!a[j][time])
                    {
                        check=1;
                        break;
                    }
                }
               if(!check)rez++;
            }
            for(int j=0;j<n;j++)
            {
                a[j][i]=a[j][i-1];
            }
            cout << rez <<'\n';
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5008 ms 48320 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4216 KB Output is correct
2 Correct 9 ms 4344 KB Output is correct
3 Correct 10 ms 4216 KB Output is correct
4 Correct 280 ms 4344 KB Output is correct
5 Runtime error 4 ms 1800 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 4216 KB Output is correct
2 Correct 9 ms 4356 KB Output is correct
3 Correct 9 ms 4344 KB Output is correct
4 Correct 8 ms 4344 KB Output is correct
5 Runtime error 5 ms 1932 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 380 KB Output is correct
8 Execution timed out 5008 ms 48320 KB Time limit exceeded
9 Halted 0 ms 0 KB -