Submission #764354

# Submission time Handle Problem Language Result Execution time Memory
764354 2023-06-23T10:54:58 Z boris_mihov Dancing Elephants (IOI11_elephants) C++17
26 / 100
9000 ms 1972 KB
#include "elephants.h"
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <random>
#include <vector>
#include <set>

typedef long long llong;
const int MAXN = 150000 + 10;
const int INF  = 2e9;

int n, len;
int a[MAXN];
int x[MAXN];
std::multiset <int> ms;
void init(int N, int L, int X[])
{
    n = N;
    len = L;
    for (int i = 0 ; i < n ; ++i)
    {
        a[i + 1] = x[i + 1] = X[i];
        ms.insert(X[i]);
    }
}

int update(int idx, int y)
{
    idx++;
    ms.erase(ms.find(x[idx]));
    x[idx] = y;
    ms.insert(y);

    int coveredTo = -1, ans = 0;
    while (true)
    {
        auto it = ms.upper_bound(coveredTo);
        if (it == ms.end())
        {
            break;
        }

        ans++;
        coveredTo = (*it) + len; 
    }

    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Execution timed out 9040 ms 1972 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Execution timed out 9040 ms 1972 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Execution timed out 9040 ms 1972 KB Time limit exceeded
8 Halted 0 ms 0 KB -