Submission #119999

# Submission time Handle Problem Language Result Execution time Memory
119999 2019-06-22T23:13:31 Z Osama_Alkhodairy Dancing Elephants (IOI11_elephants) C++17
26 / 100
9000 ms 3316 KB
#include <bits/stdc++.h>
#include "elephants.h"
//~ #include "grader.cpp"
using namespace std;

int n, l;
vector <pair <int, int> > a;

void init(int N, int L, int X[]){
    n = N;
    l = L;
    for(int i = 0 ; i < n ; i++){
        a.push_back(make_pair(X[i], i));
    }
}
int update(int i, int y){
    for(int j = 0 ; j < n ; j++){
        if(a[j].second == i){
            a.erase(a.begin() + j);
            break;
        }
    }
    for(int j = 0 ; j < n ; j++){
        if(j == n - 1 || a[j].first > y){
            a.insert(a.begin() + j, make_pair(y, i));
            break;
        }
    }
    int cur = a[0].first;
    int ans = 1;
    for(auto &i : a){
        if(cur + l < i.first){
            cur = i.first;
            ans++;
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2638 ms 1280 KB Output is correct
8 Correct 3863 ms 1408 KB Output is correct
9 Correct 4924 ms 3316 KB Output is correct
10 Correct 5628 ms 3188 KB Output is correct
11 Correct 5828 ms 3188 KB Output is correct
12 Execution timed out 9036 ms 3188 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2638 ms 1280 KB Output is correct
8 Correct 3863 ms 1408 KB Output is correct
9 Correct 4924 ms 3316 KB Output is correct
10 Correct 5628 ms 3188 KB Output is correct
11 Correct 5828 ms 3188 KB Output is correct
12 Execution timed out 9036 ms 3188 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2638 ms 1280 KB Output is correct
8 Correct 3863 ms 1408 KB Output is correct
9 Correct 4924 ms 3316 KB Output is correct
10 Correct 5628 ms 3188 KB Output is correct
11 Correct 5828 ms 3188 KB Output is correct
12 Execution timed out 9036 ms 3188 KB Time limit exceeded
13 Halted 0 ms 0 KB -