CSES - HIIT Open 2019 - Results
Submission details
Task:Final Array
Sender:bits pls
Submission time:2019-05-25 14:23:27 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#10.02 sdetails
#20.02 sdetails
#30.02 sdetails

Code

#include <iostream>

using namespace std;

int main()
{
    long arr[100001][100001];
    long n, m;
    cin >> n;
    cin >> m;
    for (long i = 0; i < m; i++) {
        long a, b, x;
        cin >> a;
        cin >> b;
        cin >> x;
        for (long k = 0; k <= b - a; k += 1) {
            arr[a + k - 1][i] = x + k;
        }
    }
    for (long i = 0; i < n; i++) {
        long mx = 0;
        for (long j = 0; j <= m; j++) {
            if (arr[i][j] > mx) mx = arr[i][j];
        }
        cout << mx;
        if (i != n - 1) cout << " ";
    }
    cout << endl;
    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:

input
8 2
1 4 1
1 8 1

correct output
1 2 3 4 5 6 7 8

user output
(empty)