Submission #119997

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

int n, l;
vector <int> a;
set <int> s;

void init(int N, int L, int X[]){
    n = N;
    l = L;
    for(int i = 0 ; i < n ; i++){
        a.push_back(X[i]);
        s.insert(X[i]);
    }
}
int update(int i, int y){
    s.erase(a[i]);
    a[i] = y;
    s.insert(a[i]);
    int cur = *s.begin();
    int ans = 1;
    for(auto &i : s){
        if(cur + l < i){
            cur = i;
            ans++;
        }
    }
    return ans;
}

Compilation message

elephants.cpp:7:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("O3")
 
elephants.cpp:8:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("unroll-loops")
# 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 2 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 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 7408 ms 1664 KB Output is correct
8 Execution timed out 9078 ms 1920 KB Time limit exceeded
9 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 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 7408 ms 1664 KB Output is correct
8 Execution timed out 9078 ms 1920 KB Time limit exceeded
9 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 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 7408 ms 1664 KB Output is correct
8 Execution timed out 9078 ms 1920 KB Time limit exceeded
9 Halted 0 ms 0 KB -