Submission #1036942

# Submission time Handle Problem Language Result Execution time Memory
1036942 2024-07-27T20:17:54 Z aaaaaarroz Dancing Elephants (IOI11_elephants) C++17
50 / 100
9000 ms 3500 KB
#include "elephants.h"
    #include<bits/stdc++.h>
    using namespace std;
    #pragma GCC optimize(2)
    int n,l;
    int arr[50100],st[50100];
    void init(int N, int L, int X[]){
        n = N;
        l=L;
        for(int i=0;i<N;i++)
            st[i]=arr[i]=X[i];
    }
    int update(int i, int y) {
        if(!l)return n;
        int ans=0,lst=-1e9;
        int p=lower_bound(st,st+n,arr[i])-st;
        while(p<n-1&&y>st[p+1])st[p]=st[p+1],p++;
        while(p&&y<st[p-1])st[p]=st[p-1],p--;
        st[p]=arr[i]=y;
        for(int b=0;b<n;b++)
            if(lst+l<st[b])
                lst=st[b],ans++;
        return ans;
    }
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 444 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 444 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
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 444 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 606 ms 1884 KB Output is correct
8 Correct 1401 ms 2052 KB Output is correct
9 Correct 1318 ms 3164 KB Output is correct
10 Correct 2563 ms 2908 KB Output is correct
11 Correct 2594 ms 2908 KB Output is correct
12 Correct 4611 ms 2904 KB Output is correct
13 Correct 2721 ms 2756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 444 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 606 ms 1884 KB Output is correct
8 Correct 1401 ms 2052 KB Output is correct
9 Correct 1318 ms 3164 KB Output is correct
10 Correct 2563 ms 2908 KB Output is correct
11 Correct 2594 ms 2908 KB Output is correct
12 Correct 4611 ms 2904 KB Output is correct
13 Correct 2721 ms 2756 KB Output is correct
14 Correct 1004 ms 2908 KB Output is correct
15 Correct 3145 ms 2972 KB Output is correct
16 Execution timed out 9076 ms 3500 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 444 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 606 ms 1884 KB Output is correct
8 Correct 1401 ms 2052 KB Output is correct
9 Correct 1318 ms 3164 KB Output is correct
10 Correct 2563 ms 2908 KB Output is correct
11 Correct 2594 ms 2908 KB Output is correct
12 Correct 4611 ms 2904 KB Output is correct
13 Correct 2721 ms 2756 KB Output is correct
14 Correct 1004 ms 2908 KB Output is correct
15 Correct 3145 ms 2972 KB Output is correct
16 Execution timed out 9076 ms 3500 KB Time limit exceeded
17 Halted 0 ms 0 KB -