Submission #974719

# Submission time Handle Problem Language Result Execution time Memory
974719 2024-05-03T17:00:16 Z Abito Street Lamps (APIO19_street_lamps) C++17
20 / 100
95 ms 10576 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
//#define int long long
#define ll long long
typedef unsigned long long ull;
using namespace std;
const int N=3e5+5;
int n,q,ans[N],on[N];
bool a[N];
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin>>n>>q;
    for (int i=1;i<=n;i++){
        char c;cin>>c;
        if (c=='1') a[i]=1;
    }
    for (int i=1;i<=q;i++){
        string s;cin>>s;
        if (s=="toggle"){
            int j;cin>>j;
            if (a[j]) ans[j]+=i-on[j];
            else on[j]=i;
            a[j]=!a[j];
        }
        else{
            int l,r;cin>>l>>r;
            cout<<ans[l]+a[l]*(i-on[l])<<endl;
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 52 ms 1292 KB Output is correct
2 Correct 55 ms 4692 KB Output is correct
3 Correct 60 ms 5200 KB Output is correct
4 Correct 95 ms 8880 KB Output is correct
5 Correct 76 ms 8912 KB Output is correct
6 Correct 80 ms 8432 KB Output is correct
7 Correct 80 ms 6984 KB Output is correct
8 Correct 82 ms 10576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -