답안 #901854

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
901854 2024-01-10T02:45:20 Z nguyentunglam 코끼리 (Dancing Elephants) (IOI11_elephants) C++17
26 / 100
9000 ms 9580 KB
#include<bits/stdc++.h>
#define fi first
#define se second
#define endl "\n"
#define ii pair<int, int>
using namespace std;

const int N = 1e5 + 10;

int n, l;

int a[N], b[N];

void init(int N, int L, int X[])
{
  n = N;

  l = L;

  for(int i = 0; i < n; i++) a[i] = X[i];
}

int update(int i, int y)
{
  a[i] = y;
  for(int i = 0; i < n; i++) b[i] = a[i];

  sort(b, b + n);

  int pre = -1e9, ans = 0;

  for(int i = 0; i < n; i++) if (b[i] - pre > l) {
    pre = b[i];
    ans++;
  }

  return ans;
}

#ifdef ngu
int x[N];
int main() {

  freopen ("task.inp", "r", stdin);
  freopen ("task.out", "w", stdout);

  int n, l, m; cin >> n >> l >> m;

  for(int i = 0; i < n; i++) cin >> x[i];

  init(n, l, x);

  while (m--) {
    int i, v; cin >> i >> v;
    cout << update(i, v) << endl;
  }
}
#endif // ngu

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8536 KB Output is correct
2 Correct 1 ms 8568 KB Output is correct
3 Correct 1 ms 8540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8536 KB Output is correct
2 Correct 1 ms 8568 KB Output is correct
3 Correct 1 ms 8540 KB Output is correct
4 Correct 1 ms 8540 KB Output is correct
5 Correct 1 ms 8644 KB Output is correct
6 Correct 1 ms 8540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8536 KB Output is correct
2 Correct 1 ms 8568 KB Output is correct
3 Correct 1 ms 8540 KB Output is correct
4 Correct 1 ms 8540 KB Output is correct
5 Correct 1 ms 8644 KB Output is correct
6 Correct 1 ms 8540 KB Output is correct
7 Correct 7274 ms 9580 KB Output is correct
8 Execution timed out 9042 ms 9564 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8536 KB Output is correct
2 Correct 1 ms 8568 KB Output is correct
3 Correct 1 ms 8540 KB Output is correct
4 Correct 1 ms 8540 KB Output is correct
5 Correct 1 ms 8644 KB Output is correct
6 Correct 1 ms 8540 KB Output is correct
7 Correct 7274 ms 9580 KB Output is correct
8 Execution timed out 9042 ms 9564 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8536 KB Output is correct
2 Correct 1 ms 8568 KB Output is correct
3 Correct 1 ms 8540 KB Output is correct
4 Correct 1 ms 8540 KB Output is correct
5 Correct 1 ms 8644 KB Output is correct
6 Correct 1 ms 8540 KB Output is correct
7 Correct 7274 ms 9580 KB Output is correct
8 Execution timed out 9042 ms 9564 KB Time limit exceeded
9 Halted 0 ms 0 KB -