#pragma once
#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> sp;
multiset<int> sp;
vector<int> ap;
int cov;
void init(int n, int l, int x[])
{
cov=l;
for(int i=0;i<n;i++)
{
sp.insert(x[i]);
ap.push_back(x[i]);
}
}
int update(int i, int y)
{
sp.erase(sp.lower_bound(ap[i]));
ap[i]=y;
sp.insert(ap[i]);
int cu=*begin(sp);
int po=0;
while(1)
{
auto it=(sp.upper_bound(cu+cov));
po++;
if(it==sp.end())
break;
cu=*it;
}
return po;
}
Compilation message
elephants.cpp:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6508 KB |
Output is correct |
2 |
Correct |
1 ms |
6504 KB |
Output is correct |
3 |
Correct |
1 ms |
6504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6508 KB |
Output is correct |
2 |
Correct |
1 ms |
6504 KB |
Output is correct |
3 |
Correct |
1 ms |
6504 KB |
Output is correct |
4 |
Correct |
1 ms |
6504 KB |
Output is correct |
5 |
Correct |
1 ms |
6504 KB |
Output is correct |
6 |
Correct |
1 ms |
6504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6508 KB |
Output is correct |
2 |
Correct |
1 ms |
6504 KB |
Output is correct |
3 |
Correct |
1 ms |
6504 KB |
Output is correct |
4 |
Correct |
1 ms |
6504 KB |
Output is correct |
5 |
Correct |
1 ms |
6504 KB |
Output is correct |
6 |
Correct |
1 ms |
6504 KB |
Output is correct |
7 |
Execution timed out |
9022 ms |
10276 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6508 KB |
Output is correct |
2 |
Correct |
1 ms |
6504 KB |
Output is correct |
3 |
Correct |
1 ms |
6504 KB |
Output is correct |
4 |
Correct |
1 ms |
6504 KB |
Output is correct |
5 |
Correct |
1 ms |
6504 KB |
Output is correct |
6 |
Correct |
1 ms |
6504 KB |
Output is correct |
7 |
Execution timed out |
9022 ms |
10276 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6508 KB |
Output is correct |
2 |
Correct |
1 ms |
6504 KB |
Output is correct |
3 |
Correct |
1 ms |
6504 KB |
Output is correct |
4 |
Correct |
1 ms |
6504 KB |
Output is correct |
5 |
Correct |
1 ms |
6504 KB |
Output is correct |
6 |
Correct |
1 ms |
6504 KB |
Output is correct |
7 |
Execution timed out |
9022 ms |
10276 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |