Submission #729114

# Submission time Handle Problem Language Result Execution time Memory
729114 2023-04-23T14:21:23 Z 1075508020060209tc Street Lamps (APIO19_street_lamps) C++14
20 / 100
705 ms 41324 KB
#include<bits/stdc++.h>

using namespace std;
#define int long long
int n;int Q;

string tss;

int ar[300005];
string typ[300005];int qa[300005];int qb[300005];
int ps[300005];
int ans[300005];
int ap[300005];
int lst[300005];
vector<int>tme[300005];
signed main(){
cin>>n>>Q;
cin>>tss;tss="*"+tss;
for(int i=1;i<=n;i++){
    ar[i]=tss[i]-'0';
    if(ar[i]){
        tme[i].push_back(0);
    }
}


for(int i=1;i<=Q;i++){
    cin>>typ[i];
    if(typ[i][0]=='q'){
        cin>>qa[i]>>qb[i];
        if(tme[qa[i]].size()%2==0){
            cout<<ap[qa[i]]<<endl;
        }else{
            cout<<ap[qa[i]]+i-tme[qa[i]].back()<<endl;
        }

    }else{
        cin>>qa[i];
        if(tme[qa[i]].size()%2==1){
            ap[qa[i]]+=i-tme[qa[i]].back();
            tme[qa[i]].push_back(i);
        }else{
            tme[qa[i]].push_back(i);
        }

    }
}

return 0;
for(int i=1;i<=n;i++){
    ps[i]=ps[i-1]+ar[i];
}
for(int i=1;i<=Q;i++){



}
for(int i=1;i<=Q;i++){
    if(typ[i][0]=='q'){
        cout<<ans[i]<<"\n";
    }
}

}


# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 16724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 392 ms 24276 KB Output is correct
2 Correct 402 ms 27724 KB Output is correct
3 Correct 390 ms 28540 KB Output is correct
4 Correct 488 ms 38968 KB Output is correct
5 Correct 516 ms 39740 KB Output is correct
6 Correct 433 ms 37892 KB Output is correct
7 Correct 650 ms 30684 KB Output is correct
8 Correct 705 ms 41324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 16724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 16764 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 16724 KB Output isn't correct
2 Halted 0 ms 0 KB -