# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1212211 | LIA | 곤돌라 (IOI14_gondola) | C++17 | 0 ms | 0 KiB |
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
vb vis(250001);
ll mx =0 ;
ll cnt = 0;
loop(i,0,n) {
vis[gondolaSeq[i]] = 1;
mx = max(mx, (ll)gondolaSeq[i]);
}
vll rep;
loop(i,1, mx+1) {
if (!vis[i]) {
rep.push_back(i);
cnt++;
}
}
sort(all(rep));
loop(i,0,rep.size()) replacementSeq[i] = rep[i];
return cnt;
}
//----------------------