Submission #747985

# Submission time Handle Problem Language Result Execution time Memory
747985 2023-05-25T09:00:17 Z Dan4Life Dancing Elephants (IOI11_elephants) C++17
0 / 100
0 ms 340 KB
#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;

const int mxN = (int)1.5e5+10;
const int B = 240;

set<int> S;
int n, L, ok;
int a[mxN], b[mxN], p[mxN];
vector<pair<int,int>> block[mxN/B];

void ins(int x){
    b[x]++; if(b[x]!=1) return; a[x]=1;
    if(ok) { S.insert(x); return; }
}

void del(int x){
    b[x]--; if(!b[x]) return; a[x]=0;
    if(ok) { S.erase(x); return;}
}

void init(int N, int l, int X[])
{
    n = N; L = l;
    if(L > N/B or 1) ok=1;
    for(int i = 0; i < n; i++)
        p[i]=X[i], ins(p[i]);
}

int update(int i, int y)
{
    del(p[i]); p[i]=y; ins(y);
    int ans = 0;
    if(ok){
        auto itr = S.lower_bound(0);
        while(itr!=S.end()) itr = S.lower_bound(*itr+L), ans++;
        return ans;
    }
    return ans;
}

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -