Submission #973113

# Submission time Handle Problem Language Result Execution time Memory
973113 2024-05-01T13:51:04 Z Unforgettablepl Street Lamps (APIO19_street_lamps) C++17
0 / 100
63 ms 11564 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

int tree[1048576];
int last[300001];

int get(int l,int r){
    int ans = INT32_MAX;
    l+=524288;r+=524288;
    while(l<=r){
        if(l&1)ans=min(ans,tree[l++]);
        if(r%2==0)ans = min(ans,tree[r--]);
        l/=2;r/=2;
    }
    return ans;
}

void update(int k,int x){
    k+=524288;
    tree[k] = x;
    k/=2;
    while(k){
        tree[k] = min(tree[2*k],tree[2*k+1]);
        k/=2;
    }
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    for(int&i:tree)i=INT32_MAX;
    int n,q;
    cin >> n >> q;
    for(int i=1;i<=n;i++){
        char a;cin>>a;
        if(a=='0')update(i,0);
    }
    for(int i=1;i<=q;i++){
        string type;cin>>type;
        if(type=="toggle"){
            int x;cin>>x;
            update(x,i);
        } else {
            int l,r;cin>>l>>r;r--;
            cout << min(get(l,r),i) << '\n';
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 8784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 11564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8952 KB Output is correct
2 Incorrect 2 ms 8792 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8796 KB Output is correct
2 Correct 2 ms 8652 KB Output is correct
3 Incorrect 2 ms 8792 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 8784 KB Output isn't correct
2 Halted 0 ms 0 KB -