Started on abc257

This commit is contained in:
2022-12-05 12:50:59 +01:00
parent 27d00340b9
commit b0fc6d0e58
10 changed files with 122 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
use proconio::input;
fn main() {
input!{
n: usize,
k: usize,
q: usize,
a: [usize; k],
l: [usize; q],
};
let mut board = vec![false; n];
let mut positions = vec![0; k];
let mut p = 0;
for pos in a {
board[pos - 1] = true;
positions[p] = pos - 1;
p += 1;
}
for turn in l {
let pos = positions[turn - 1];
if pos != n - 1 && !board[pos + 1] {
board[pos] = false;
board[pos + 1] = true;
positions[turn - 1] = pos + 1;
}
}
for pos in positions {
print!("{} ", pos + 1);
} print!("\n");
}