Submission #386911

# Submission time Handle Problem Language Result Execution time Memory
386911 2021-04-07T15:55:39 Z Aldas25 Dancing Elephants (IOI11_elephants) C++14
26 / 100
9000 ms 5892 KB
#include "elephants.h"
#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i <= (b); i++)

const int MAXN = 500100;

int n, l;
set<int> pos;
map<int, int> cnt;
int x[MAXN];

void init(int N, int L, int X[])
{
    n = N;
    l = L;
    FOR(i, 0, N-1) {
        cnt[X[i]]++;
        pos.insert(X[i]);
        x[i] = X[i];
    }
}

int update(int i, int y)
{
    cnt[x[i]]--;
    if (cnt[x[i]] == 0) pos.erase(x[i]);
    x[i] = y;
    cnt[x[i]]++;
    pos.insert(x[i]);

    int lstSt = -l-5;
    int ret = 0;
    //cout << " --" << endl;
    for (int p : pos) {
           // cout << "p = " << p << endl;
        if (p > lstSt+l) {
            lstSt = p;
            ret++;
      //      cout << " lstSt = " << p << endl;
        }
    }

    return ret;

}

/*

4 10 5
10
15
17
20
2 16 1
1 25 2
3 35 2
0 38 2
2 0 3


*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 7114 ms 5648 KB Output is correct
8 Execution timed out 9075 ms 5892 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 7114 ms 5648 KB Output is correct
8 Execution timed out 9075 ms 5892 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 7114 ms 5648 KB Output is correct
8 Execution timed out 9075 ms 5892 KB Time limit exceeded
9 Halted 0 ms 0 KB -