Thanks to visit codestin.com
Credit goes to github.com

Skip to content

More examples #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

qryxip
Copy link
Member

@qryxip qryxip commented Feb 8, 2020

  • num
    • num-bigint
    • num-complex (new)
    • num-integer
    • num-iter
    • num-rational (new)
    • num-traits
  • num-derive
  • ndarray
  • nalgebra (new)
    • alga (new)
  • libm
  • rand
    • getrandom
    • rand_chacha
    • rand_core
    • rand_hc
    • rand_pcg
  • rand_distr
  • petgraph
  • indexmap
  • regex
  • lazy_static
  • ordered-float (new)
  • ascii (new)
  • permutohedron
  • superslice
  • itertools
  • itertools-num (new)
  • maplit
  • either (new)
  • im-rc
  • fixedbitset
  • bitset-fixed (new)
  • proconio
  • text_io
  • whiteread
  • rustc-hash (new)
  • smallvec

@qryxip
Copy link
Member Author

qryxip commented Feb 8, 2020

  • 今あるやつ
    practice contestのB - Interactive Sorting、なんか入力がおかしいなと思ってたら Q を読み(飛ばし)忘れるといったアホをやらかしてたので修正。
  • ABC122: C - GeT AC
    primal削除したときにitertools-numの例が一緒に消えてたので追加。 オーソドックスに先頭に0を追加してVecにしたあと区間和を何度も取る。
  • ABC143: D - Triangles
    supersliceのupper_boundと、nC2通りを列挙するのにitertoolsのtuple_combinationsを使う。
  • ABC127: F - Absolute Minima
    ' ''\n'を区別できると行をVec<i64>で取ってslice patternにかけると綺麗なのではないかと思い、whitereadのために追加。 あとwhiteread以外ではeitherを使ってクエリをEither<(i64, i64), ()>にした。 少々無理矢理感があるけれど求値クエリに引数がある場合の想定ということで。
  • ABC147: C - HonestOrUnkind2
    Itertools::tuple_combinationsを使ってnC2通りの組み合わせを列挙。
  • ABC154: D - Dice in Line
    今週のやつ。 Dropboxのがもう公開されていたので(最近早い)。 ordered-floatとitertools-num(2つめ)を使う。 ordered-floatが無くてもf64::maxfoldするかmax_byでなんとかできるしそもそも0.5区切りなので整数で計算できるしで微妙な気はするけど無いよりは。 BinaryHeapとかに詰めなきゃいけない問題がAtCoderのどこかに無いものか..
  • ABC154: E - Almost Everywhere Zero
    今週のやつその2。 この記事の解法だとnum::integer::binomial<u64>が使える。 想定解で二項係数が出てくる場合大抵ℤ/pℤ上でやらされるのでこれが必要になるのは珍しいように思える。
  • ABC145: C - Average Length
    nalgebraにPoint2とかVector2ってあったよなと思い追加(num-complexでもいいだろうけど)。nC2通りの組み合わせを列挙するのにItertools::tuple_combinationsと、各点同士の距離√((x_i - x_j)^2 + (y_i - y_j)^2)を求めるのにnalgebra::distanceを使う。
  • ABC156: D - Bouquet
    num_traits::pow、ndarrayやnalgebraの行列累乗には無理だけどmodintには使えるのではと思い追加。
  • ABC157: D - Friend Suggestions
    petgraph::unionfind::UnionFindの例。 UnionFindからはrankもsizeも取れないがなんとかする。
  • ABC157: E - Simple String Queries
    BITをalga::generalで抽象化する。 ちょうどAbstractMonoidAbstractGroupがあるので。 あとクエリ問題なので3+1種類用意。
  • ABC158: D - String Formation
    ' ''\n'を区別できると行をVec<char>で取ってslice patternにかけると綺麗なのではないかと思い、whitereadのために追加。 あとproconioだと綺麗に書けないのでクエリに対して手でimpl Sourceし、Outputはeitherを使ってEither<(), (bool, u8)>にした。 少々無理矢理感があるけれど求値クエリに引数がある場合の想定ということで。
  • ABC160: E - Red and Green Apples
    Itertools::kmerge_by
  • ABC162 - C - Sum of gcd of Tuples (Easy)
    itertools::iproduct!num_integer::gcd
  • ABC165 - B - 1%
    itertools::iterate (std::iter::successorsSome固定版)
  • ABC165 - C - Many Requirements
    Itertools::combinations_with_replacement
  • ABC166 - B - Trick or Treat
    Itertools::uniqueからのcountでワンライナー。 あと入力が[[Usize1]]と綺麗に書ける。 (本家のinput!に由来する機能だけどQiitaの方には無いこともあってあまり知られてない気がする 見てみたら無かった。 記憶違い。)
  • ABC168 - B - ... (Triple Dots)
    asciiが適している問題がついぞ見つからなかったのでとりあえず目についたこれを追加。
  • ABC168 - C - : (Colon)
    num_complexComplex::from_polarで極座標からコンストラクトできる。
  • ABC168 - E - ∙ (Bullet)
    num_rationalRatio::recipで逆元が取れる。
  • AGC023: A - Zero-Sum Ranges
    最強の200点問題と名高いやつ。 ただしやることは簡単でcounter (HashMap<i64, u64>)に{ Σ_{k=0}^{i} A_k }を詰めていくだけ。 itertools-numの例その3。 Vecにする必要も無いのでIteratorをそのままfor文に突っ込む。 ついでにmaplit::hashmap!#[proconio::fastout]も使用。
  • AGC026: C - String Coloring
    rustc_hash::FxHasherItertools::{collect_vec, partition_map}を使用。 ただこの問題においてはデフォルトのHasherとの違いがあまり無い、というよりハッシュがボトルネックでは無い気がするので微妙感はある。
  • AGC020: C - Median Sum
    bitset-fixedのREADMEの解法をほぼそのまま。 fixedbitsetだとビットシフトができない。
  • APC001: C Vacant Seat
    "Interactive Sorting"の他にインタラクティブ問題を何か入れたほうがいいかなと思ってたので手軽そうなこれを。
  • Judge System Update Test Contest 202004: ABCD
    ABCD全部itertoolsとかsupersliceとかnumが活躍できる問題だったので。
  • パナソニックプログラミングコンテスト2020: D - String
    高々長さ10の文字列を表わすのにSmallVec<[u8; 10]>を用いる。

@qryxip qryxip force-pushed the ja-all-enabled-more-examples branch 4 times, most recently from e3860f3 to 9544ce3 Compare February 18, 2020 03:22
@qryxip qryxip force-pushed the ja-all-enabled-more-examples branch 2 times, most recently from 0ef37c3 to f673cb4 Compare February 21, 2020 18:18
@qryxip qryxip force-pushed the ja-all-enabled-more-examples branch 3 times, most recently from 5e41017 to 49f1350 Compare March 9, 2020 23:23
@qryxip qryxip force-pushed the ja-all-enabled-more-examples branch from b6e815c to 0f5ab70 Compare March 17, 2020 03:37
@qryxip qryxip force-pushed the ja-all-enabled-more-examples branch 5 times, most recently from 0c047c4 to c1afd19 Compare April 2, 2020 09:50
@qryxip qryxip force-pushed the ja-all-enabled-more-examples branch 2 times, most recently from 8b29828 to e7dac0a Compare April 6, 2020 05:18
@qryxip qryxip force-pushed the ja-all-enabled-more-examples branch 3 times, most recently from dfb624b to 47ad0f9 Compare April 25, 2020 11:16
@qryxip qryxip force-pushed the ja-all-enabled-more-examples branch 2 times, most recently from 8f0f874 to 8865cb6 Compare May 5, 2020 15:13
@qryxip qryxip force-pushed the ja-all-enabled-more-examples branch 3 times, most recently from 15cd824 to 3b7107e Compare May 18, 2020 10:28
@qryxip qryxip force-pushed the ja-all-enabled-more-examples branch from 3b7107e to 90e66d3 Compare May 18, 2020 15:20
@qryxip
Copy link
Member Author

qryxip commented May 18, 2020

indexmapim-rcが適している問題が結局見つからないので一旦完了したいです... @statiolake

@statiolake
Copy link
Contributor

長らくの間頻繁に更新してくださっていたのに、その間何もお手伝いできなくてすみませんでした。

これほど例が充実しているというのは、なんというか正直信じられないレベルです。本当にありがとうございます。きっと多くの方々の参考になると思います。というかまずすでに私が助かっています、いろいろと知らなかったことを知れました。

それでは、一旦ここでマージさせていただきます。本当にありがとうございます!

@statiolake statiolake merged commit c524def into rust-lang-ja:ja-all-enabled May 18, 2020
@qryxip qryxip deleted the ja-all-enabled-more-examples branch May 18, 2020 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants