#include <bits/stdc++.h>
using namespace std;
const int c=100005;
int n, t[c], pos;
void init(int N, vector<int> sz) {
n=N;
for (int i=0; i<n; i++) {
t[i+1]=sz[i];
if (t[i+1]>t[i]) pos++;
}
}
/*
int lassu(int l, int r, int d) {
int ut=t[l]+d, ans=0, id=1;
for (int i=l; i<=r; i++) {
if (id==1) {
ut=max(ut, t[i]);
if (ut-t[i]>=d) {
ut=t[i];
id=0;
ans++;
}
} else {
ut=min(ut, t[i]);
if (t[i]-ut>=d) {
ut=t[i];
id=1;
}
}
}
return ans;
}
*/
int max_towers(int l, int r, int d) {
l++, r++;
if (l<=pos && pos<=r && max(t[l], t[r])+d<=t[pos]) return 2;
return 1;
}
/*
int main()
{
int N;
vector<int> P;
cin >> N;
for (int i=0; i<N; i++) {
int x;
cin >> x;
P.push_back(x);
}
init(N, P);
int q;
cin >> q;
while (q--) {
int l, r, d;
cin >> l >> r >> d;
cout << max_towers(l, r, d) << "\n";
}
return 0;
}
*/
/*
7
1 2 6 4 5 3 7
3
1 5 1
1 5 2
1 5 3
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
323 ms |
976 KB |
Output is correct |
2 |
Correct |
809 ms |
1360 KB |
Output is correct |
3 |
Correct |
815 ms |
1440 KB |
Output is correct |
4 |
Correct |
598 ms |
1360 KB |
Output is correct |
5 |
Correct |
781 ms |
1360 KB |
Output is correct |
6 |
Correct |
821 ms |
1444 KB |
Output is correct |
7 |
Correct |
883 ms |
1360 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
614 ms |
1352 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
176 ms |
516 KB |
1st lines differ - on the 1st token, expected: '7197', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
323 ms |
976 KB |
Output is correct |
2 |
Correct |
809 ms |
1360 KB |
Output is correct |
3 |
Correct |
815 ms |
1440 KB |
Output is correct |
4 |
Correct |
598 ms |
1360 KB |
Output is correct |
5 |
Correct |
781 ms |
1360 KB |
Output is correct |
6 |
Correct |
821 ms |
1444 KB |
Output is correct |
7 |
Correct |
883 ms |
1360 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |