{"id":16039804,"url":"https://github.com/hpprc/atcoder-with-rust-in-mac","last_synced_at":"2025-04-10T11:09:49.497Z","repository":{"id":101122441,"uuid":"255351952","full_name":"hppRC/AtCoder-with-Rust-in-mac","owner":"hppRC","description":":crab: Setup for AtCoder with Rust","archived":false,"fork":false,"pushed_at":"2020-04-14T03:02:26.000Z","size":16,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T09:52:56.831Z","etag":null,"topics":["atcoder","cargo","rust"],"latest_commit_sha":null,"homepage":"https://github.com/hppRC/RustAtCoder","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hppRC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-13T14:33:18.000Z","updated_at":"2024-07-28T15:46:55.000Z","dependencies_parsed_at":"2023-05-24T11:45:28.892Z","dependency_job_id":null,"html_url":"https://github.com/hppRC/AtCoder-with-Rust-in-mac","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hppRC%2FAtCoder-with-Rust-in-mac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hppRC%2FAtCoder-with-Rust-in-mac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hppRC%2FAtCoder-with-Rust-in-mac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hppRC%2FAtCoder-with-Rust-in-mac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hppRC","download_url":"https://codeload.github.com/hppRC/AtCoder-with-Rust-in-mac/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208555,"owners_count":21065202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atcoder","cargo","rust"],"created_at":"2024-10-08T23:08:05.126Z","updated_at":"2025-04-10T11:09:49.467Z","avatar_url":"https://github.com/hppRC.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AtCoder with Rust in mac\n\n[cargo atcoder](https://github.com/tanakh/cargo-atcoder)を使用させていただいています。\n\n## セットアップ\n\nまずこのリポジトリを clone します。\nAtCoder 用の環境を作りたい場所で、以下のコマンドを実行してください。\nわかる方はこのリポジトリを`use template`(緑色のボタンのやつ)して頂いても大丈夫です。\n\n```bash\ngit clone https://github.com/hppRC/AtCoder-with-Rust-in-mac.git\n```\n\n次に、クローンしてきた場所に移動します。\n\n```bash\n# どこかのディレクトリからAtCoder用のディレクトリへ\ncd AtCoder-with-Rust-in-mac\n```\n\n次に、セットアップ用のスクリプトを実行します。\nこれを実行すると、Rust 本体のインストールし、AtCoder 用の config ファイルのシンボリックリンクを貼り、brew で必要なパッケージをインストールします。\nもしすでにインストール済みならインストールを行わないように処理を書いていますが、気になるようであれば`init.sh`を読んでみてください。めっちゃ単純です。\n\n```bash\nbash ./init.sh\n```\n\nちなみに Rust の各種ツールのインストールはちょっと長めです。気長に待ちましょう。自分の mac は火を吹きました。多分普通だと思います。\n\nインストールが終わると**login**を求められるので、AtCoder のユーザー名とパスワードを入力ください。\n\n### Docker をインストールしていない方へ\n\nクロスコンパイル(コンパイルされる環境と実行環境が違う時にいい感じにコンパイル)するために、cross というツールを使用します。これは Docker を使用するので、Docker を install する必要があります。\n\nこちらの記事\\[[Docker を Mac にインストールする（更新: 2019/7/13）](https://qiita.com/kurkuru/items/127fa99ef5b2f0288b81)\\]に詳しく載っていますが、一応手順をさらっと書いておきます。\n\nDocker のインストールはやり方を知っていると簡単です。まず[Docker 公式サイト](https://hub.docker.com/editions/community/docker-ce-desktop-mac)にアクセスして`create account`してください。Docker を使うためには~~なぜか~~DockerHub というところのアカウントを作る必要があるので、ここは我慢してください。\n\n適当にインストール手順が出てくると思うので、いい感じにこなすとコマンドラインで docker が呼べるようになっています。`docker version`を実行してみましょう。\n\n### 長い戦いの果てに\n\nさて、これで環境は整ったはずです。\n早速問題を解いて提出してみましょう！\n\nちなみにですが、Rust 何もわからん、という方のための動作確認用に自分のリポジトリへのリンクを貼っておきます。\nご自由にお使いください。\n\n[https://github.com/hppRC/RustAtCoder](https://github.com/hppRC/RustAtCoder)\n\nまた、clone してきたリポジトリを自分のリポジトリとして管理したい！という場合は`git init`なり`rm -rf ./.git`なりして頂いて大丈夫です。こちもご自由にお使いください。\n\n## 基本操作\n\n使用させて頂いている[cargo-atcoder](https://github.com/tanakh/cargo-atcoder)の README に詳しい説明が載っているので、特に書くことはありませんがメモがわりに残しておきます。\n\nまた、AtCoder で使える Rust の基本的な情報については、先人の方々が残してくださった記事のリンクを列挙させていただきます。\n以下をご参照ください。\n\n- [AtCoder コンテストに Rust で参加するためのガイドブック](https://doc.rust-jp.rs/atcoder-rust-resources/introduction.html)\n- [AtCoder 2020 年言語アップデート以降の環境](https://github.com/rust-lang-ja/atcoder-rust-resources/wiki/2020-Update)\n- [AtCoder のジャッジシステムアップデートによって Rust で使えるようになる便利 API たちの紹介](https://qiita.com/maguro_tuna/items/b4472d7497eac57fc101)\n- [AtCoder 言語アップデートで Rust の入出力が楽になっていた](https://qiita.com/koji-cw/items/0cce3b075faffe5e50ed)\n\n#### Rust アップデート以前の記事(バージョンは違いますが役に立つ情報がたくさん載っていますのでぜひご参照ください)\n\n- [Rust で競技プログラミング スターターキット](https://qiita.com/hatoo@github/items/fa14ad36a1b568d14f3e)\n- [AtCoder に登録したら解くべき精選過去問 10 問を Rust で解いてみた](https://qiita.com/tubo28/items/e6076e9040da57368845)\n- [Rust で楽しむ競技プログラミング](https://www.slideshare.net/YusukeYoshimoto2/rust-137863085)\n\n### 解法を投げる\n\n```bash\ncargo atcoder submit \u003cproblem-id\u003e\n```\n\n### バイナリで投げる(デフォルトはこっちにしてあります)\n\n手元でコンパイル済みのものを提出として投げるので、自作の crate(ライブラリ)を使えるようになったり、世の中の便利 crate を引っ張ってきて使わせてもらうこともできます。\nproconio という crate は言語アップデート後のジャッジでしか対応していないはずなので、とりあえずバイナリを投げておくのが安全策ではあります。(どんな問題にも使えるので)\n\n```bash\ncargo atcoder submit --bin \u003cproblem-id\u003e\n```\n\n#### 便利なやつ\n\n```bash\nalias cas=\"cargo atcoder submit\"\n```\n\nこれで例えば abc152 ディレクトリに移動して\n\n```bash\ncas a\n```\n\nと打てば提出できる\n\n### 提出状況確認\n\n```bash\ncargo atcoder status\n```\n\n### 便利 alias 群\n\n既存のエイリアスやコマンドとかぶらないようにしてお使いください。\n\n```bash\nalias cas=\"cargo atcoder submit\"\nalias can=\"cargo atcoder new\"\n```\n\n### cargo-atcoder.toml を Git 管理\n\ntoml ファイルも git 管理したいのは非常に常識的な感覚だと思うので、シンボリックリンクの貼り方も載せておきます。\nシンボリックリンクは(誤解を恐れずに言うと)ファイルのドッペルゲンガーを作るようなコマンドで、一方で編集した内容がもう一方にも反映させることができます。\n\n**macOS 環境を想定**\n\n```\n# ln -sf ~/path/to/your_directory/cargo-atcoder.toml ~/Library/Preferences/\n# 現在いるディレクトリのcargo-atcoder.toml から ~/Library/Preferences/ へ貼るには以下\n\nln -sf $(pwd)/cargo-atcoder.toml ~/Library/Preferences/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhpprc%2Fatcoder-with-rust-in-mac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhpprc%2Fatcoder-with-rust-in-mac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhpprc%2Fatcoder-with-rust-in-mac/lists"}