답안 #51128

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
51128 2018-06-16T06:52:51 Z 강태규(#1289, imeimi2000) 코끼리 (Dancing Elephants) (IOI11_elephants) C++11
26 / 100
9000 ms 9348 KB
#include "elephants.h"
#include <algorithm>

using namespace std;

const int MAXN = 2e5;
int n, l, x[MAXN], a[MAXN];

void init(int N, int L, int X[]) {
    n = N;
    l = L;
    for (int i = 0; i < n; ++i) a[i] = x[i] = X[i];
    sort(x, x + n);
}

int update(int p, int y) {
    for (int i = 0; i < n; ++i) {
        if (x[i] == a[p]) {
            for (; i < n; ++i) {
                x[i] = x[i + 1];
            }
        }
    }
    a[p] = y;
    for (p = 0; p + 1 < n && x[p] < y; ++p);
    for (int i = n - 1; i > p; --i) x[i] = x[i - 1];
    x[p] = y;
    
    p = x[0] + l;
    int ret = 1;
    for (int i = 1; i < n; ++i) {
        if (p < x[i]) {
            ++ret;
            p = x[i] + l;
        }
    }
    return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 560 KB Output is correct
4 Correct 2 ms 560 KB Output is correct
5 Correct 2 ms 560 KB Output is correct
6 Correct 2 ms 672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 560 KB Output is correct
4 Correct 2 ms 560 KB Output is correct
5 Correct 2 ms 560 KB Output is correct
6 Correct 2 ms 672 KB Output is correct
7 Correct 3442 ms 2196 KB Output is correct
8 Correct 4922 ms 3364 KB Output is correct
9 Correct 5638 ms 5312 KB Output is correct
10 Correct 5987 ms 6592 KB Output is correct
11 Correct 5849 ms 7852 KB Output is correct
12 Execution timed out 9092 ms 9348 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 560 KB Output is correct
4 Correct 2 ms 560 KB Output is correct
5 Correct 2 ms 560 KB Output is correct
6 Correct 2 ms 672 KB Output is correct
7 Correct 3442 ms 2196 KB Output is correct
8 Correct 4922 ms 3364 KB Output is correct
9 Correct 5638 ms 5312 KB Output is correct
10 Correct 5987 ms 6592 KB Output is correct
11 Correct 5849 ms 7852 KB Output is correct
12 Execution timed out 9092 ms 9348 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 560 KB Output is correct
4 Correct 2 ms 560 KB Output is correct
5 Correct 2 ms 560 KB Output is correct
6 Correct 2 ms 672 KB Output is correct
7 Correct 3442 ms 2196 KB Output is correct
8 Correct 4922 ms 3364 KB Output is correct
9 Correct 5638 ms 5312 KB Output is correct
10 Correct 5987 ms 6592 KB Output is correct
11 Correct 5849 ms 7852 KB Output is correct
12 Execution timed out 9092 ms 9348 KB Time limit exceeded
13 Halted 0 ms 0 KB -