Submission #1076616

# Submission time Handle Problem Language Result Execution time Memory
1076616 2024-08-26T15:01:33 Z ArthuroWich Dancing Elephants (IOI11_elephants) C++17
26 / 100
9000 ms 10332 KB
#include "elephants.h"
#include<bits/stdc++.h>
using namespace std;
int n, l;
vector<int> a;
multiset<int> p;
void init(int N, int L, int X[]) {
    n = N, l = L;
    a.resize(n);
    for (int i = 0; i < n; i++) {
        a[i] = X[i];
        p.insert(X[i]);
    }
}
int update(int i, int y) {
    p.erase(p.find(a[i]));
    a[i] = y;
    p.insert(a[i]);
    int ans = 0, be;
    auto ind = p.begin();
    while(ind != p.end()) {
        ans++;
        ind = p.upper_bound(*ind+l);
    }
    return ans;
}

Compilation message

elephants.cpp: In function 'int update(int, int)':
elephants.cpp:19:18: warning: unused variable 'be' [-Wunused-variable]
   19 |     int ans = 0, be;
      |                  ^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Execution timed out 9048 ms 10332 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Execution timed out 9048 ms 10332 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Execution timed out 9048 ms 10332 KB Time limit exceeded
8 Halted 0 ms 0 KB -