Skip to content

Commit

Permalink
Extract overwrite_abc317_a_solution to a separate script
Browse files Browse the repository at this point in the history
  • Loading branch information
yiwiy9 committed Sep 18, 2023
1 parent 3adbb65 commit 7d75d99
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 12 additions & 0 deletions .github/scripts/overwrite_abc317_a_solution.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Function to Overwrite ABC317 Problem A Solution in Rust
filepath="$1"
cat > "$filepath" <<EOF
use proconio::input;
use superslice::*;
fn main() {
input! { n: usize,h: usize,x: usize,p: [usize; n] };
println!("{}", p.lower_bound(&(x - h)) + 1);
}
EOF
16 changes: 2 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,15 @@ jobs:
with:
imageName: ghcr.io/yiwiy9/atcoder-rust-devcontainer
runCmd: |
# Function to Overwrite ABC317 Problem A Solution in Rust
overwrite_abc317_a_solution() {
cat > "$1" <<-EOF
use proconio::input;
use superslice::*;
fn main() {
input! { n: usize,h: usize,x: usize,p: [usize; n] };
println!("{}", p.lower_bound(&(x - h)) + 1);
}
EOF
}
# Testing "cargo_compete_new.sh"
cargo_compete_new.sh abc317
cd $WORKSPACE_FOLDER/src/contest/abc317/
overwrite_abc317_a_solution a.rs
$WORKSPACE_FOLDER/.github/scripts/overwrite_abc317_a_solution.sh a.rs
cargo compete test a
# Testing "cargo compete add"
cargo_compete_new.sh practice
cd $WORKSPACE_FOLDER/src/contest/practice/
cargo compete add abc317_a
overwrite_abc317_a_solution abc317_a.rs
$WORKSPACE_FOLDER/.github/scripts/overwrite_abc317_a_solution.sh abc317_a.rs
cargo compete test abc317_a

0 comments on commit 7d75d99

Please sign in to comment.