Submission #964814

# Submission time Handle Problem Language Result Execution time Memory
964814 2024-04-17T15:30:18 Z Trisanu_Das Dancing Elephants (IOI11_elephants) C++17
0 / 100
8 ms 16988 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 = lower_bound(a_ + 1, a_ + n + 1, a[idx]) - a;
  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")
      |
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 16988 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 16988 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 16988 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 16988 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 16988 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -