Submission #721715

# Submission time Handle Problem Language Result Execution time Memory
721715 2023-04-11T06:47:19 Z victor_gao Street Lamps (APIO19_street_lamps) C++17
20 / 100
1 ms 596 KB
//#pragma GCC optimize("Ofast,unroll-loops,O3")
//#pragma GCC optimize("avx,avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,fma,tune=native")
#include<bits/stdc++.h>
//#include<bits/extc++.h>
//#pragma pack(1)
#define fast ios::sync_with_stdio(0); cin.tie(0);
#define int long long
#define pii pair<int,int>
#define x first
#define y second
using namespace std;
//using namespace __gnu_pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//typedef tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> order_multiset;
//typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> order_set;
int s[105][105],n,q;
bool arr[105];
signed main(){
    fast
    cin>>n>>q;
    for (int i=1;i<=n;i++){
        char c; cin>>c;
        arr[i]=c-'0';
        s[1][i]=arr[i]+s[1][i-1];
    }
    for (int t=2;t<=q+1;t++){
        string str; cin>>str;
        if (str=="toggle"){
            int p; cin>>p;
            arr[p]^=1;
        }
        else {
            int ans=0,l,r; cin>>l>>r;
            for (int i=1;i<t;i++){
                if (s[i][r-1]-s[i][l-1]==r-l)
                    ans++;
            }
            cout<<ans<<'\n';
        }
        for (int i=1;i<=n;i++)
            s[t][i]=arr[i]+s[t][i-1];
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 596 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 596 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Runtime error 1 ms 596 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -