Submission #447669

# Submission time Handle Problem Language Result Execution time Memory
447669 2021-07-27T09:53:09 Z dxz05 Dancing Elephants (IOI11_elephants) C++14
26 / 100
9000 ms 2764 KB
#include "elephants.h"
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 2e5 + 3e2;

int N, L;
int X[MAXN];

set<int> s;
void init(int _N, int _L, int _X[]){
    N = _N;
    L = _L;

    for (int i = 0; i < N; i++){
        X[i] = _X[i];
        s.insert(X[i]);
    }

}

int update(int i, int y){
    s.erase(X[i]);
    X[i] = y;
    s.insert(y);

    int ans = 1, last = *s.begin();
    for (int x : s){
        if (x - last > L){
            ans++;
            last = x;
        }
    }

    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 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 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 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 6498 ms 2484 KB Output is correct
8 Execution timed out 9064 ms 2764 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 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 6498 ms 2484 KB Output is correct
8 Execution timed out 9064 ms 2764 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 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 6498 ms 2484 KB Output is correct
8 Execution timed out 9064 ms 2764 KB Time limit exceeded
9 Halted 0 ms 0 KB -