Submission #425121

# Submission time Handle Problem Language Result Execution time Memory
425121 2021-06-12T13:36:30 Z SAAD Street Lamps (APIO19_street_lamps) C++17
0 / 100
5000 ms 3196 KB
#define F first
#define S second
#define rep(i,a,b) for(int i=a;!(a==b&&i!=b)&&((i<=b&&b>=a)||(i>=b&&a>=b));i+=(a<=b?1:-1))
#define pb push_back
#define Fbitl __builtin_ffs
#define bit1 __builtin_popcount
#define pi acos(-1)
//#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
int num[300002] ;
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n , q,p,b;
    cin >> n >> q;
    string s,a,g=" ";
    cin >> s;
    g += s ;
    s = g ;
    vector <string> qe ;
    while ( q-- ) {
        cin >> a;
        if (a == "toggle") {
            cin >> p;
            s[p] = (s[p]-48?'0':'1');
        }
        else {
            qe.pb(s);
            cin >> p >> b ;
            int res = 0 ;
            for (auto i:qe) {
                bool th = true; 
                for (int j=p;j<b;j++) {
                    if(th&&i[j]=='0')th=false;
                }
                if(th)res++;
            }
            cout << res << endl ;
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5031 ms 3196 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Incorrect 5 ms 588 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 1336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -