답안 #1093958

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1093958 2024-09-28T06:55:21 Z Aviansh 코끼리 (Dancing Elephants) (IOI11_elephants) C++17
50 / 100
9000 ms 1624 KB
#include <bits/stdc++.h>
#include "elephants.h"

using namespace std;

int n;
int l;
int *x;
int uni[70000];
int siz = 0;

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

void rem(int ind){
    for(int i = ind+1;i<siz;i++){
        uni[i-1]=uni[i];
    }
    siz--;
}

void add(int ind , int val){
    siz++;
    for(int i = siz;i>ind;i--){
        uni[i]=uni[i-1];
    }
    uni[ind]=val;
}

int update(int i, int y)
{
    for(int e = 0;e<siz;e++){
        if(uni[e]==x[i]){
            rem(e);
            break;
        }
    }
    x[i]=y;
    if(uni[siz-1]<x[i]){
        add(siz,x[i]);
    }
    else{
        for(int e = 0;e<siz;e++){
            if(uni[e]>=x[i]){
                add(e,x[i]);
                break;
            }
        }
    }
    int ans = 1;
    int las = uni[0];
    for(int i = 0;i<siz;i++){
        int curr = uni[i];
        if(curr-las>l){
            las=curr;
            ans++;
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1257 ms 1116 KB Output is correct
8 Correct 2466 ms 1176 KB Output is correct
9 Correct 3517 ms 1368 KB Output is correct
10 Correct 2355 ms 1432 KB Output is correct
11 Correct 2526 ms 1372 KB Output is correct
12 Correct 7272 ms 1444 KB Output is correct
13 Correct 2841 ms 1372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1257 ms 1116 KB Output is correct
8 Correct 2466 ms 1176 KB Output is correct
9 Correct 3517 ms 1368 KB Output is correct
10 Correct 2355 ms 1432 KB Output is correct
11 Correct 2526 ms 1372 KB Output is correct
12 Correct 7272 ms 1444 KB Output is correct
13 Correct 2841 ms 1372 KB Output is correct
14 Correct 1727 ms 1372 KB Output is correct
15 Correct 5395 ms 1368 KB Output is correct
16 Execution timed out 9035 ms 1624 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1257 ms 1116 KB Output is correct
8 Correct 2466 ms 1176 KB Output is correct
9 Correct 3517 ms 1368 KB Output is correct
10 Correct 2355 ms 1432 KB Output is correct
11 Correct 2526 ms 1372 KB Output is correct
12 Correct 7272 ms 1444 KB Output is correct
13 Correct 2841 ms 1372 KB Output is correct
14 Correct 1727 ms 1372 KB Output is correct
15 Correct 5395 ms 1368 KB Output is correct
16 Execution timed out 9035 ms 1624 KB Time limit exceeded
17 Halted 0 ms 0 KB -