CSES - HIIT Open 2019 - Results
Submission details
Task:Final Array
Sender:bits pls
Submission time:2019-05-25 14:51:30
Language:C++
Status:READY
Result:
Test results
testverdicttime
#10.09 sdetails
#20.10 sdetails
#30.11 sdetails

Code

#include <iostream>
#include <vector>


using namespace std;

int main()
{
    //vector< vector<long> > arr;
    long** arr = new long*[100001];
    for (long i = 0; i < 100001; i++) arr[i] = new long[100001];
    //long arr[10000][10000];

    long n, m;
    cin >> n;
    cin >> m;
    for (long i = 0; i < m; i++) {
        long a, b;
        long 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 << " ";
    }
    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)