Submission #916113

# Submission time Handle Problem Language Result Execution time Memory
916113 2024-01-25T10:16:06 Z JakobZorz Dancing Elephants (IOI11_elephants) C++17
50 / 100
9000 ms 9176 KB
#include"elephants.h"
#include<vector>
#include<algorithm>
using namespace std;

int n,l;
int pos[150000];
vector<int>arr;

void init(int N,int L,int X[]){
    n=N;
    l=L;
    for(int i=0;i<n;i++){
        pos[i]=X[i];
        arr.push_back(X[i]);
    }
    sort(arr.begin(),arr.end());
}

int update(int i,int y){
    auto it=lower_bound(arr.begin(),arr.end(),pos[i]);
    arr.erase(it);
    pos[i]=y;
    it=upper_bound(arr.begin(),arr.end(),pos[i]);
    arr.insert(it,y);
    
    int res=0;
    int pos=-1;
    for(int i=0;i<n;i++){
        if(arr[i]>pos){
            res++;
            pos=arr[i]+l;
        }
    }
    
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6584 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6584 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6584 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1063 ms 7836 KB Output is correct
8 Correct 2029 ms 8208 KB Output is correct
9 Correct 1608 ms 8784 KB Output is correct
10 Correct 1755 ms 8664 KB Output is correct
11 Correct 1749 ms 8532 KB Output is correct
12 Correct 5328 ms 8720 KB Output is correct
13 Correct 1909 ms 8400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6584 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1063 ms 7836 KB Output is correct
8 Correct 2029 ms 8208 KB Output is correct
9 Correct 1608 ms 8784 KB Output is correct
10 Correct 1755 ms 8664 KB Output is correct
11 Correct 1749 ms 8532 KB Output is correct
12 Correct 5328 ms 8720 KB Output is correct
13 Correct 1909 ms 8400 KB Output is correct
14 Correct 1184 ms 8560 KB Output is correct
15 Correct 4302 ms 8540 KB Output is correct
16 Execution timed out 9030 ms 9176 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6584 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1063 ms 7836 KB Output is correct
8 Correct 2029 ms 8208 KB Output is correct
9 Correct 1608 ms 8784 KB Output is correct
10 Correct 1755 ms 8664 KB Output is correct
11 Correct 1749 ms 8532 KB Output is correct
12 Correct 5328 ms 8720 KB Output is correct
13 Correct 1909 ms 8400 KB Output is correct
14 Correct 1184 ms 8560 KB Output is correct
15 Correct 4302 ms 8540 KB Output is correct
16 Execution timed out 9030 ms 9176 KB Time limit exceeded
17 Halted 0 ms 0 KB -