Submission details
Task:Lucky prefixes
Sender:Cystem Administrators
Submission time:2025-11-08 14:00:08 +0200
Language:C++ (C++17)
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2--details
#30.00 sdetails
#40.27 sdetails
#5ACCEPTED0.43 sdetails
#60.30 sdetails
#70.32 sdetails
#80.38 sdetails
#9ACCEPTED0.43 sdetails
#100.00 sdetails
#110.28 sdetails
#12ACCEPTED0.43 sdetails
#130.30 sdetails
#140.32 sdetails
#150.38 sdetails
#16ACCEPTED0.43 sdetails

Compiler report

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

Code

#include <bits/stdc++.h>

using namespace std;

typedef int64_t ll;
typedef uint64_t ull;

int main() {
    ull n; ull q;
    cin >> n >> q;

    vector<ll> arr (n);

    for (ull i = 0; i < n; i++) {
        ll num;
        cin >> num;
        arr.at(i) = num;
    }

    for (ull i = 0; i < q; i++) {
        int type; ll a; ll b;
        cin >> type >> a >> b;
        if (type == 2) {
            bool lucky = true;
            ll summa = 0;
            for (ull it = 0; it < b-a; it++) {
                summa += arr[a-1+it];
                if (summa<0) {
                    lucky = false;
                    break;
                }
            }
            cout << (lucky ? "YES" : "NO") << endl;
        } else {
            arr.at(a-1) = b;
        }
    }

}

Test details

Test 1

Verdict: ACCEPTED

input
6 4
3 -2 1 5 6 1
2 1 3
2 2 3
1 3 -2
...

correct output
YES
NO
NO

user output
YES
NO
NO

Test 2

Verdict:

input
200000 200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
NO
NO
NO
NO
NO
...

user output
(empty)

Test 3

Verdict:

input
10 10
629447384 -729045992 811583872...

correct output
YES
NO
NO
NO
NO
...

user output
YES
YES
NO
YES
NO
...

Feedback: Incorrect character on line 2 col 1: expected "NO", got "YES"

Test 4

Verdict:

input
1 200000
629447384
1 1 670017180
1 1 826751744
1 1 -804919168
...

correct output
NO
NO
NO
YES
YES
...

user output
YES
YES
YES
YES
YES
...

Feedback: Incorrect character on line 1 col 1: expected "NO", got "YES"

Test 5

Verdict: ACCEPTED

input
200000 200000
629447384 -729045992 811583872...

correct output
NO
NO
NO
NO
NO
...

user output
NO
NO
NO
NO
NO
...

Test 6

Verdict:

input
1000 200000
629447384 -729045992 811583872...

correct output
NO
NO
NO
NO
NO
...

user output
NO
NO
NO
NO
NO
...

Feedback: Incorrect character on line 2363 col 1: expected "NO", got "YES"

Test 7

Verdict:

input
10000 200000
629447384 -729045992 811583872...

correct output
NO
NO
NO
NO
NO
...

user output
NO
NO
NO
NO
NO
...

Feedback: Incorrect character on line 341 col 1: expected "NO", got "YES"

Test 8

Verdict:

input
100000 200000
629447384 -729045992 811583872...

correct output
NO
NO
NO
NO
NO
...

user output
NO
NO
NO
NO
NO
...

Feedback: Incorrect character on line 7935 col 1: expected "NO", got "YES"

Test 9

Verdict: ACCEPTED

input
200000 200000
629447384 -729045992 811583872...

correct output
NO
NO
NO
NO
NO
...

user output
NO
NO
NO
NO
NO
...

Test 10

Verdict:

input
10 10
629447384 -729045992 811583872...

correct output
YES
NO
NO
NO
NO
...

user output
YES
YES
NO
YES
NO
...

Feedback: Incorrect character on line 2 col 1: expected "NO", got "YES"

Test 11

Verdict:

input
1 200000
629447384
1 1 670017180
1 1 826751744
1 1 -804919168
...

correct output
NO
NO
NO
YES
YES
...

user output
YES
YES
YES
YES
YES
...

Feedback: Incorrect character on line 1 col 1: expected "NO", got "YES"

Test 12

Verdict: ACCEPTED

input
200000 200000
629447384 -729045992 811583872...

correct output
NO
NO
NO
NO
NO
...

user output
NO
NO
NO
NO
NO
...

Test 13

Verdict:

input
1000 200000
629447384 -729045992 811583872...

correct output
NO
NO
NO
NO
NO
...

user output
NO
NO
NO
NO
NO
...

Feedback: Incorrect character on line 2363 col 1: expected "NO", got "YES"

Test 14

Verdict:

input
10000 200000
629447384 -729045992 811583872...

correct output
NO
NO
NO
NO
NO
...

user output
NO
NO
NO
NO
NO
...

Feedback: Incorrect character on line 341 col 1: expected "NO", got "YES"

Test 15

Verdict:

input
100000 200000
629447384 -729045992 811583872...

correct output
NO
NO
NO
NO
NO
...

user output
NO
NO
NO
NO
NO
...

Feedback: Incorrect character on line 7935 col 1: expected "NO", got "YES"

Test 16

Verdict: ACCEPTED

input
200000 200000
629447384 -729045992 811583872...

correct output
NO
NO
NO
NO
NO
...

user output
NO
NO
NO
NO
NO
...