답안 #607446

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
607446 2022-07-26T17:31:58 Z APROHACK 코끼리 (Dancing Elephants) (IOI11_elephants) C++14
26 / 100
9000 ms 2540 KB
#include "elephants.h"
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;
ll n;
ll mn, mx, l;
vector<pair<ll, ll> >a;
map<int, int> pos; // indx a is in indx b
void upd(){
  sort(a.begin(), a.end());
  for(int i = 0 ; i < n ; i ++){
    pos[a[i].ss] = i;
  }
}
void init(int N, int L, int X[])
{
  n = N, l = L;
  for(int i = 0 ; i < n ; i++){
    a.pb({X[i], i});
  }
  upd();
  
}

int update(int i, int y)
{
  a[pos[i]]={y, a[pos[i]].ss};
  upd();
  ll cuenta = 1, curr = a[0].ff;
  for(int i = 1 ; i < n ; i ++){
    if(curr+l >= a[i].ff)continue;
    cuenta++;
    curr = a[i].ff  ;
  }
  return cuenta;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Execution timed out 9058 ms 2540 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Execution timed out 9058 ms 2540 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Execution timed out 9058 ms 2540 KB Time limit exceeded
8 Halted 0 ms 0 KB -