// Problem: Dancing Elephants
// Contest: Virtual Judge - OJUZ
// URL: https://vjudge.net/problem/OJUZ-IOI11_elephants
// Memory Limit: 256 MB
// Time Limit: 9000 ms
#define condition 0 // 0提交,1本地,2调试
#if condition==0
#include "elephants.h"
#endif
#include <bits/stdc++.h>
using namespace std;
const int MAXN=150005;
int n, l, x[MAXN];
#if condition
int elephant_cnt, camera_length, operation_cnt, elephants_pos[MAXN];
#endif
/*
*/
int update(int id, int y)
{
// 修改
x[++id]=y, sort(x+1, x+n+1);
// 求答案
int res=1, last=1;
for (int i = 2; i <= n; ++i) {
if (x[i]-x[last] > l) {
++res, last=i;
}
}
// 返回答案
return res;
}
void init(int ec, int cl, int ep[])
{
// 复制变量
n=ec, l=cl;
for (int i = 0; i < n; ++i) { x[i+1]=ep[i]; }
}
#if condition
int main()
{
cin.tie(nullptr) -> sync_with_stdio(false);
// I.N.
cin >> elephant_cnt >> camera_length;
for (int i = 0; i < elephant_cnt; ++i) {
cin >> elephants_pos[i];
}
init(elephant_cnt, camera_length, elephants_pos);
// O.P.
cin >> operation_cnt;
while (operation_cnt--) {
int id, y;
cin >> id >> y;
cout << update(id, y) << endl;
}
// E.D.
return 0;
}
#endif
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |