| Task: | Final Array |
| Sender: | Agonaudid |
| Submission time: | 2019-05-25 13:00:20 +0300 |
| Language: | Java |
| Status: | READY |
| Result: | TIME LIMIT EXCEEDED |
| test | verdict | time | |
|---|---|---|---|
| #1 | TIME LIMIT EXCEEDED | -- | details |
| #2 | TIME LIMIT EXCEEDED | -- | details |
| #3 | ACCEPTED | 0.19 s | details |
Code
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while(scan.hasNextLine()){
String[] in = scan.nextLine().split(" ");
int n = Integer.parseInt(in[0]);
int m = Integer.parseInt(in[1]);
int[] arr = new int[n];
for (int i = 0; i<m; i++) {
String[] inn = scan.nextLine().split(" ");
int a = Integer.parseInt(inn[0]);
int b = Integer.parseInt(inn[1]);
int x = Integer.parseInt(inn[2]);
int l = 0;
for (int j = a - 1; j<b; j++) {
arr[j] = Math.max(arr[j], x + l);
l+=1;
}
}
StringBuilder sb = new StringBuilder();
for (int h = 0; h < arr.length ; h++) {
sb.append(arr[h]);
sb.append(" ");
}
System.out.println(sb.toString().trim());
}
}
}
Test details
Test 1
Verdict: TIME LIMIT EXCEEDED
| 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: TIME LIMIT EXCEEDED
| 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 |
