Submission #255854

# Submission time Handle Problem Language Result Execution time Memory
255854 2020-08-02T01:17:46 Z balbit Street Lamps (APIO19_street_lamps) C++14
20 / 100
483 ms 4984 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long

#define pll pair<ll, ll>
#define f first
#define s second

#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
#define pb push_back

#ifdef BALBIT
#define bug(...) cerr<<"#"<<__LINE__<<" "<<#__VA_ARGS__<<": ", _do(__VA_ARGS__)
template<typename T> void _do(T && x ){ cerr<<x<<endl; }
template<typename T, typename ...S> void _do(T && x , S&&...y){ cerr<<x<<", "; _do(y...);}
#define IOS()
#else
#define IOS() ios::sync_with_stdio(0),cin.tie(0)
#define endl '\n'
#define bug(...)
#endif // BALBIT

const int maxn = 3e5+5;

//vector<pii> g[maxn];
bool hi[maxn];
int ans[105][105];

signed main(){
    IOS();
    int n,q; cin>>n>>q;

    for (int i = 0; i<n; ++i) {
        char c; cin>>c; hi[i] = c=='1';
    }

    for (int i = 0; i<q; ++i) {
        for (int l = 0; l<n; ++l) {
            for (int r = l; r<n; ++r) {
                if (!hi[r]) break;
                ans[l][r]++;
            }
        }
        string s; cin>>s;
        if (s[0] == 'q') {
            int a,b; cin>>a>>b; --a; --b;
            cout<<ans[a][b-1]<<endl;
        }else{
            int x; cin>>x;
            --x;
            hi[x] ^=1;
        }
    }

}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 211 ms 4472 KB Output is correct
2 Incorrect 483 ms 4984 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 211 ms 4472 KB Output is correct
9 Incorrect 483 ms 4984 KB Output isn't correct
10 Halted 0 ms 0 KB -