CSES - HIIT Open 2019 - Results
Submission details
Task:Final Array
Sender:bits pls
Submission time:2019-05-25 14:57:56 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1--details
#2--details
#3ACCEPTED0.02 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:14:17: warning: unused variable 't' [-Wunused-variable]
         long x, t;
                 ^

Code

#include <iostream>


using namespace std;

int main()
{
    long* arr = new long[100001];
    long n, m;
    cin >> n;
    cin >> m;
    for (long i = 0; i < m; i++) {
        long a, b;
        long x, t;
        cin >> a;
        cin >> b;
        cin >> x;
        for (long k = 0; k <= b - a; k += 1) {
            if (arr[a+k-1] < x) arr[a+k-1] = x;
            x += 1;
        }
    }
    for (long i = 0; i < n; i++) {
        cout << arr[i];
        if (i != n - 1) cout << " ";
    }
    return 0;
}

Test details

Test 1

Verdict:

input
100000 100000
29706 39977 913671103
20575 89990 878449866
1691 70785 229168045
81099 81323 611730238
...

correct output
227121122 450258482 450258483 ...

user output
(empty)

Test 2

Verdict:

input
100000 100000
1 100000 1
1 100000 2
1 100000 3
1 100000 4
...

correct output
100000 100001 100002 100003 10...

user output
(empty)

Test 3

Verdict: ACCEPTED

input
8 2
1 4 1
1 8 1

correct output
1 2 3 4 5 6 7 8

user output
1 2 3 4 5 6 7 8