-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFEB-LTIME-HILLS.cpp
70 lines (52 loc) · 1.33 KB
/
FEB-LTIME-HILLS.cpp
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
Contest: FEB-LTIME
Host: CodeChef
Problem: HILLS
Current Submission Status : WA
*/
#include <bits/stdc++.h>
#define MAX 110
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
printf("test case:%d\n", t);
hello:
int n, count;
long int u,d;
long int h[MAX];
count==0;
cin>>n>>u>>d;
for(int i=1; i<=n; i++){
cin>>h[i];
if(i>1){
if(h[i] == h[i-1]){
}
else if(h[i] > h[i-1]){
if((h[i] - h[i-1]) > u){
count=2;
printf("count=%d ans=%d\n", count,i-1);
goto hello;
}
}
else if(h[i] < h[i-1]){
if(h[i] == h[i-1]){
}
else if((h[i-1]-h[1]) > d){
count++;
if(count==2){
printf("count=%d ans=%d\n", count,i-1);
goto hello;
}
}
}
}
if(i==n+1){
if(count<=1)
printf("ans=%d\n", n);
}
}
}
return 0;
}