Submission #405509

# Submission time Handle Problem Language Result Execution time Memory
405509 2021-05-16T13:38:36 Z Jarif_Rahman Street Lamps (APIO19_street_lamps) C++17
20 / 100
5000 ms 524292 KB
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, q; cin >> n >> q;
    vector<vector<int>> v(1, vector<int>(n));
    for(int &x: v[0]){
        char c; cin >> c; x = c-'0';
    }
    while(q--){
        v.pb(v.back());
        str tt; cin >> tt;
        if(tt == "toggle"){
            int in; cin >> in; in--;
            v.back()[in] = !v.back()[in];
        }
        else{
            int a, b; cin >> a >> b; a--, b-=2;
            int cnt = 0;
            for(int i = 0; i < (int)v.size() - 1; i++){
                bool bl = 1;
                for(int j = a; j <= b; j++) if(!v[i][j]) bl = 0;
                if(bl) cnt++;
            }
            cout << cnt << "\n";
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5100 ms 20640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4172 KB Output is correct
2 Correct 35 ms 4172 KB Output is correct
3 Correct 61 ms 4224 KB Output is correct
4 Correct 103 ms 4180 KB Output is correct
5 Runtime error 279 ms 524292 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 106 ms 4268 KB Output is correct
2 Correct 96 ms 4168 KB Output is correct
3 Correct 63 ms 4232 KB Output is correct
4 Correct 8 ms 4172 KB Output is correct
5 Runtime error 228 ms 524292 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Execution timed out 5100 ms 20640 KB Time limit exceeded
9 Halted 0 ms 0 KB -