답안 #119996

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
119996 2019-06-22T23:02:11 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 optimization ("O3")

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:6:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("O3")
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 7054 ms 1668 KB Output is correct
8 Execution timed out 9042 ms 1920 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 7054 ms 1668 KB Output is correct
8 Execution timed out 9042 ms 1920 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 7054 ms 1668 KB Output is correct
8 Execution timed out 9042 ms 1920 KB Time limit exceeded
9 Halted 0 ms 0 KB -