-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUVa_00105.java
executable file
·53 lines (36 loc) · 1015 Bytes
/
UVa_00105.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import java.util.*;
import java.io.*;
public class UVa00105 {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int[] height = new int[10000];
String line ;
String ans = "";
while ( (line= in.readLine()) != null){
StringTokenizer stk = new StringTokenizer(line);
int l = Integer.parseInt(stk.nextToken());
int h = Integer.parseInt(stk.nextToken());
int r = Integer.parseInt(stk.nextToken());
if( l == 0)
ans += "0";
for(int i = l ; i <r ;i++){
height[i] = Math.max(h,height[i] );
}
}
int temp = -1;
for (int i = 1; i < height.length ; i++){
if(temp !=height[i]){
temp = height[i];
if(!ans.equals("") && !ans.equals("0")){
ans += " "+i+" "+height[i];
}
else
ans +=i+" "+height[i];
}
}
System.out.println(ans);
in.close();
System.exit(0);
}
}