답안 #248549

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
248549 2020-07-12T17:25:08 Z A02 코끼리 (Dancing Elephants) (IOI11_elephants) C++14
26 / 100
9000 ms 3072 KB
#include "elephants.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <utility>

using namespace std;

int n;
long long l;
vector<long long> elephant_positions;
set<long long> sorted_elephant_set;

void init(int N, int L, int X[])
{
    n = N;
    l = L;

    for (int i = 0; i < N; i++){
        elephant_positions.push_back(X[i]);
        sorted_elephant_set.insert(X[i]);
    }

}

int update(int i, int y)
{

    sorted_elephant_set.erase(elephant_positions[i]);
    sorted_elephant_set.insert(y);
    elephant_positions[i] = y;

    long long current_start = -2 * l;
    long long current_cameras = 0;
    for (set<long long>::iterator it = sorted_elephant_set.begin(); it != sorted_elephant_set.end(); it++){

        if (*(it) - current_start > l){
            current_start = *(it);
            current_cameras++;
        }

    }

    return current_cameras;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 6714 ms 2560 KB Output is correct
8 Execution timed out 9082 ms 3072 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 6714 ms 2560 KB Output is correct
8 Execution timed out 9082 ms 3072 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 6714 ms 2560 KB Output is correct
8 Execution timed out 9082 ms 3072 KB Time limit exceeded
9 Halted 0 ms 0 KB -