CSES - Aalto Competitive Programming 2024 - wk4 - Homework - Results
Submission details
Task:Dynamic Range Minimum Queries
Sender:htoik
Submission time:2024-09-25 15:09:04 +0300
Language:C++ (C++20)
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2--details

Code

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;

int main(){
    ull n, q;
    std::cin >> n >> q;
    vector<ull> ns;
    ns.reserve(n);
    for(ull i=0; i<n; i++){
        ull nn;
        cin >> nn;
        ns.push_back(nn);
    }

    for(ull i=0; i<q; i++){
        ull t, a, b;
        cin >> t >> a >> b;
        if(t == 1){
            ns[a-1] = b;
        }
        else{
            ull minval = *min_element(ns.begin()+(a-1), ns.begin()+(b));
            cout << minval << endl;
        }
    }
}

Test details

Test 1

Verdict: ACCEPTED

input
8 80
7 6 4 6 2 9 4 8
2 1 1
2 1 2
2 1 3
...

correct output
7
6
4
4
2
...

user output
7
6
4
4
2
...
Truncated

Test 2

Verdict:

input
200000 200000
398739055 65343131 699208332 3...

correct output
28609
129890
20378
20378
311522
...

user output
(empty)