답안 #500325

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
500325 2021-12-30T18:15:24 Z aryan12 코끼리 (Dancing Elephants) (IOI11_elephants) C++17
26 / 100
9000 ms 2372 KB
#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 2e5 + 5;
int n, len;
set<int> pos;
int cur_pos[MAXN];

void init(int N, int L, int X[]) {
    n = N;
    len = L;
    for(int i = 0; i < N; i++) {
        pos.insert(X[i]);
        cur_pos[i] = X[i];
    }
}

int update(int i, int y)
{
    pos.erase(cur_pos[i]);
    cur_pos[i] = y;
    pos.insert(cur_pos[i]);
    int ans = 0, x = *(pos.begin());
    while(true) {
        ans++;
        if(pos.lower_bound(x + len + 1) == pos.end()) {
            break;
        }
        x = *(pos.lower_bound(x + len + 1));
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 288 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 288 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Execution timed out 9086 ms 2372 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 288 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Execution timed out 9086 ms 2372 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 288 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Execution timed out 9086 ms 2372 KB Time limit exceeded
8 Halted 0 ms 0 KB -