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

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:11:19: warning: comparison of integer expressions of different signedness: 'int' and 'ull' {aka 'long long unsigned int'} [-Wsign-compare]
   11 |     for(int i=0; i<n; i++){
      |                  ~^~

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(int 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-1));
            cout << minval << endl;
        }
    }
}

Test details

Test 1

Verdict:

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
7
6
4
4
...
Truncated

Test 2

Verdict:

input
200000 200000
398739055 65343131 699208332 3...

correct output
28609
129890
20378
20378
311522
...

user output
(empty)