Submission #52116

# Submission time Handle Problem Language Result Execution time Memory
52116 2018-06-24T04:42:01 Z 노영훈(#1330, Diuven) Dancing Elephants (IOI11_elephants) C++11
26 / 100
9000 ms 2928 KB
#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;
const int MX=50010;
int n, k;
int pos[MX];
map<int, int> cnt;

void init(int N, int L, int X[]){
    n=N, k=L;
    for(int i=0; i<n; i++) pos[i]=X[i], cnt[X[i]]++;
}

int update(int i, int y){
    cnt[pos[i]]--;
    if(cnt[pos[i]]==0) cnt.erase(cnt.find(pos[i]));
    cnt[y]++; pos[i]=y;
    vector<int> X;
    for(auto &p:cnt){
        int x=p.first;
        X.push_back(x);
    }
    int l=X[0], ans=1;
    for(int x:X){
        if(l+k<x) l=x, ans++;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 3 ms 528 KB Output is correct
5 Correct 3 ms 708 KB Output is correct
6 Correct 3 ms 708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 3 ms 528 KB Output is correct
5 Correct 3 ms 708 KB Output is correct
6 Correct 3 ms 708 KB Output is correct
7 Execution timed out 9022 ms 2928 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 3 ms 528 KB Output is correct
5 Correct 3 ms 708 KB Output is correct
6 Correct 3 ms 708 KB Output is correct
7 Execution timed out 9022 ms 2928 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 3 ms 528 KB Output is correct
5 Correct 3 ms 708 KB Output is correct
6 Correct 3 ms 708 KB Output is correct
7 Execution timed out 9022 ms 2928 KB Time limit exceeded
8 Halted 0 ms 0 KB -