-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA.cpp
More file actions
54 lines (47 loc) · 1.05 KB
/
A.cpp
File metadata and controls
54 lines (47 loc) · 1.05 KB
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
# include <vector>
# include <algorithm>
# include <iostream>
# include <map>
# include <unordered_map>
# include <set>
# include <unordered_set>
# include <string>
# define vi vector<int>
# define vs vector<string>
# define vvi vector<vector<int>>
# define vvs vector<vector<string>>
# define ll long long
# define ull unsigned long long
# define lp(n) for (int i=0; i<n; i++)
# define lp1(s, e, st) for (int i=s; i<e; i+=st)
using namespace std;
void solve()
{
int n, k;
cin >> n >> k;
vi v(n);
for (int i=0; i<n; i++) cin >> v[i];
int p1 = 0, p2 = n - 1;
int count = 0;
while (p1 <= p2)
{
if (v[p1] <= k and ++count)
p1++;
else if (v[p2] <= k and ++count)
p2--;
else
{
cout << count << endl;
return ;
}
}
cout << n << endl;
}
int main()
{
int cases = 1;
//cin >> cases;
while (cases--)
solve();
return (0);
}