답안 #964815

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
964815 2024-04-17T15:30:51 Z Trisanu_Das 코끼리 (Dancing Elephants) (IOI11_elephants) C++17
50 / 100
9000 ms 8804 KB
#pragma optimize("Ofast")
#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;
}

Compilation message

elephants.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Ofast")
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8540 KB Output is correct
2 Correct 1 ms 8540 KB Output is correct
3 Correct 1 ms 8536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8540 KB Output is correct
2 Correct 1 ms 8540 KB Output is correct
3 Correct 1 ms 8536 KB Output is correct
4 Correct 1 ms 8540 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8540 KB Output is correct
2 Correct 1 ms 8540 KB Output is correct
3 Correct 1 ms 8536 KB Output is correct
4 Correct 1 ms 8540 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8536 KB Output is correct
7 Correct 1147 ms 8672 KB Output is correct
8 Correct 2226 ms 8696 KB Output is correct
9 Correct 1952 ms 8796 KB Output is correct
10 Correct 3327 ms 8796 KB Output is correct
11 Correct 3310 ms 8804 KB Output is correct
12 Correct 6824 ms 8796 KB Output is correct
13 Correct 3545 ms 8800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8540 KB Output is correct
2 Correct 1 ms 8540 KB Output is correct
3 Correct 1 ms 8536 KB Output is correct
4 Correct 1 ms 8540 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8536 KB Output is correct
7 Correct 1147 ms 8672 KB Output is correct
8 Correct 2226 ms 8696 KB Output is correct
9 Correct 1952 ms 8796 KB Output is correct
10 Correct 3327 ms 8796 KB Output is correct
11 Correct 3310 ms 8804 KB Output is correct
12 Correct 6824 ms 8796 KB Output is correct
13 Correct 3545 ms 8800 KB Output is correct
14 Correct 1440 ms 8692 KB Output is correct
15 Correct 4666 ms 8712 KB Output is correct
16 Execution timed out 9027 ms 8792 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8540 KB Output is correct
2 Correct 1 ms 8540 KB Output is correct
3 Correct 1 ms 8536 KB Output is correct
4 Correct 1 ms 8540 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8536 KB Output is correct
7 Correct 1147 ms 8672 KB Output is correct
8 Correct 2226 ms 8696 KB Output is correct
9 Correct 1952 ms 8796 KB Output is correct
10 Correct 3327 ms 8796 KB Output is correct
11 Correct 3310 ms 8804 KB Output is correct
12 Correct 6824 ms 8796 KB Output is correct
13 Correct 3545 ms 8800 KB Output is correct
14 Correct 1440 ms 8692 KB Output is correct
15 Correct 4666 ms 8712 KB Output is correct
16 Execution timed out 9027 ms 8792 KB Time limit exceeded
17 Halted 0 ms 0 KB -