#include "towers.h"
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <vector>
#include <fstream>
#include <bitset>
#include <tuple>
#include <cmath>
#include <cstdint>
#include <stack>
#include <cassert>
#include <cstdio>
#include <queue>
#include <iterator>
#include <iomanip>
#include <algorithm>
#include <sstream>
using namespace std;
vector<int> towers;
void init(int N, std::vector<int> H) {
towers.resize(N,-1);
for (int i = 1; i < N-1; i++)
{
int mx = max(H[i - 1], H[i + 1]);
if (mx <= H[i]) towers[i] = H[i] - mx;
}
}
int max_towers(int L, int R, int D) {
int sum=0;
bool prev = false;
for (int i = L; i <= R; i++)
{
if (towers[i] >= D) {
sum++ ;
if (!prev) sum++;
prev = true;
}
}
if(R-L>=2)return sum;
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
882 ms |
932 KB |
1st lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '292', found: '215' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '292', found: '215' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4006 ms |
1460 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1332 ms |
556 KB |
1st lines differ - on the 1st token, expected: '7197', found: '5748' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '292', found: '215' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
882 ms |
932 KB |
1st lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |