Submission #391202

# Submission time Handle Problem Language Result Execution time Memory
391202 2021-04-18T08:22:26 Z rocks03 Dancing Elephants (IOI11_elephants) C++14
50 / 100
9000 ms 3432 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << ": " << x << " "
#define nl cout << "\n"
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define per(i, a, b) for(int i = (a); i >= (b); i--)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int *a, N, L;
vector<int> st;
void init(int n, int l, int X[]){
    a = X, N = n, L = l;
    rep(i, 0, n) st.pb(X[i]);
}

int update(int i, int y){
    st.erase(find(all(st), a[i]));
    a[i] = y;
    st.insert(upper_bound(all(st), a[i]), a[i]);
    int ans = 1, p = st[0];
    rep(i, 1, N){
        if(p + L < st[i]){
            p = st[i], ans++;
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 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 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 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 332 KB Output is correct
7 Correct 2152 ms 1060 KB Output is correct
8 Correct 3194 ms 1108 KB Output is correct
9 Correct 3152 ms 3012 KB Output is correct
10 Correct 2639 ms 2884 KB Output is correct
11 Correct 2835 ms 2756 KB Output is correct
12 Correct 7547 ms 2884 KB Output is correct
13 Correct 3090 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 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 332 KB Output is correct
7 Correct 2152 ms 1060 KB Output is correct
8 Correct 3194 ms 1108 KB Output is correct
9 Correct 3152 ms 3012 KB Output is correct
10 Correct 2639 ms 2884 KB Output is correct
11 Correct 2835 ms 2756 KB Output is correct
12 Correct 7547 ms 2884 KB Output is correct
13 Correct 3090 ms 2520 KB Output is correct
14 Correct 1681 ms 2932 KB Output is correct
15 Correct 6030 ms 2780 KB Output is correct
16 Execution timed out 9064 ms 3432 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 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 332 KB Output is correct
7 Correct 2152 ms 1060 KB Output is correct
8 Correct 3194 ms 1108 KB Output is correct
9 Correct 3152 ms 3012 KB Output is correct
10 Correct 2639 ms 2884 KB Output is correct
11 Correct 2835 ms 2756 KB Output is correct
12 Correct 7547 ms 2884 KB Output is correct
13 Correct 3090 ms 2520 KB Output is correct
14 Correct 1681 ms 2932 KB Output is correct
15 Correct 6030 ms 2780 KB Output is correct
16 Execution timed out 9064 ms 3432 KB Time limit exceeded
17 Halted 0 ms 0 KB -