답안 #411281

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
411281 2021-05-24T22:36:58 Z LouayFarah 코끼리 (Dancing Elephants) (IOI11_elephants) C++14
26 / 100
9000 ms 1808 KB
#include "bits/stdc++.h"
#include "elephants.h"
using namespace std;

int n, l;
int *x;
vector<int> pos;
vector<int> ele;

void init(int N, int L, int X[])
{
    n = N;
    l = L;
    x = X;
    pos.resize(n);
    ele.resize(n);
    for(int i = 0; i<n; i++)
    {
        pos[i] = i;
        ele[i] = x[i];
    }

}

int solve()
{
    int len = x[0];
    len+=l;
    int res = 1;
    int j = 1;
    while(j<n)
    {
        while(j<n&&x[j]<=len)
            j++;
        res++;
        len = x[j]+l;
    }

    return res-1;
}

int update(int i, int y)
{
    int ind = lower_bound(x, x+n, ele[i]) - x;
    x[ind] = y;
    ele[i] = y;
    sort(x, x+n);
    int res = solve();
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Execution timed out 9087 ms 1808 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Execution timed out 9087 ms 1808 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Execution timed out 9087 ms 1808 KB Time limit exceeded
8 Halted 0 ms 0 KB -