#include <bits/stdc++.h>
using namespace std;
const int c=100005;
int n, t[c];
set<pair<int, int> > s;
vector<pair<int, pair<int, int> > > sz;
void init(int N, vector<int> sz) {
n=N;
for (int i=0; i<n; i++) {
t[i+1]=sz[i];
}
}
int max_towers(int l, int r, int d) {
l++, r++;
for (int i=l-1; i<=r+1; i++) {
s.insert({i, 1});
}
for (int i=l; i<=r; i++) {
sz.push_back({t[i], {1, i}}), sz.push_back({t[i]+d, {0, i}});
}
sort(sz.begin(), sz.end());
int maxi=0, ert=0;
for (auto x:sz) {
int id=x.second.first, pos=x.second.second;
auto it=s.upper_bound({pos, -1});
int cnt=0;
it++;
cnt+=(*it).second;
it--, it--;
cnt+=(*it).second;
if (id==0) {
if (cnt==2) {
ert++;
}
s.insert({pos, id});
}
if (id==1) {
if (!cnt) {
ert--;
}
s.erase({pos, id});
}
maxi=max(maxi, ert);
}
s.clear(), sz.clear();
return maxi;
}
/*
int main()
{
return 0;
}
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4075 ms |
4728 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '12' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '12' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4073 ms |
7904 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4027 ms |
2416 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '12' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4075 ms |
4728 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |