답안 #964811

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
964811 2024-04-17T15:27:22 Z Trisanu_Das 코끼리 (Dancing Elephants) (IOI11_elephants) C++17
50 / 100
9000 ms 10588 KB
#include <bits/stdc++.h>
using namespace std;
 
int l, a[150005], a_[150005], n;
 
void init(int N, int L, int X[]){
  n = N; l = L;
  a_[0] = INT_MIN, a_[n + 1] = INT_MAX;
  for(int i = 0; i < n; i++) a_[i + 1] = a[i] = X[i];
}
 
int update(int idx, int val){
  int i = 0;
  while(a_[i] != a[idx]) ++i;
  a_[i] = a[idx] = val;
  while(a_[i - 1] > a_[i]) swap(a_[i - 1], a_[i]), i--;
  while(a_[i + 1] < a_[i]) swap(a_[i + 1], a_[i]), i++;
  int ans = 1, last = a_[1];
  for(int i = 2; i <= n; i++)
    if(a_[i] - last > l) ++ans, last = a_[i];
  
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8540 KB Output is correct
2 Correct 2 ms 8540 KB Output is correct
3 Correct 1 ms 8540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8540 KB Output is correct
2 Correct 2 ms 8540 KB Output is correct
3 Correct 1 ms 8540 KB Output is correct
4 Correct 1 ms 8644 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8540 KB Output is correct
2 Correct 2 ms 8540 KB Output is correct
3 Correct 1 ms 8540 KB Output is correct
4 Correct 1 ms 8644 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8540 KB Output is correct
7 Correct 1183 ms 9576 KB Output is correct
8 Correct 2263 ms 9704 KB Output is correct
9 Correct 1914 ms 10364 KB Output is correct
10 Correct 3334 ms 10140 KB Output is correct
11 Correct 3367 ms 10080 KB Output is correct
12 Correct 6984 ms 10228 KB Output is correct
13 Correct 3605 ms 9932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8540 KB Output is correct
2 Correct 2 ms 8540 KB Output is correct
3 Correct 1 ms 8540 KB Output is correct
4 Correct 1 ms 8644 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8540 KB Output is correct
7 Correct 1183 ms 9576 KB Output is correct
8 Correct 2263 ms 9704 KB Output is correct
9 Correct 1914 ms 10364 KB Output is correct
10 Correct 3334 ms 10140 KB Output is correct
11 Correct 3367 ms 10080 KB Output is correct
12 Correct 6984 ms 10228 KB Output is correct
13 Correct 3605 ms 9932 KB Output is correct
14 Correct 1400 ms 10196 KB Output is correct
15 Correct 4797 ms 10132 KB Output is correct
16 Execution timed out 9057 ms 10588 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8540 KB Output is correct
2 Correct 2 ms 8540 KB Output is correct
3 Correct 1 ms 8540 KB Output is correct
4 Correct 1 ms 8644 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8540 KB Output is correct
7 Correct 1183 ms 9576 KB Output is correct
8 Correct 2263 ms 9704 KB Output is correct
9 Correct 1914 ms 10364 KB Output is correct
10 Correct 3334 ms 10140 KB Output is correct
11 Correct 3367 ms 10080 KB Output is correct
12 Correct 6984 ms 10228 KB Output is correct
13 Correct 3605 ms 9932 KB Output is correct
14 Correct 1400 ms 10196 KB Output is correct
15 Correct 4797 ms 10132 KB Output is correct
16 Execution timed out 9057 ms 10588 KB Time limit exceeded
17 Halted 0 ms 0 KB -