ブログ名

競技プログラミングやお歌のお話をする高菜です。

AOJ-ICPC 150 点問題の練習です。

f:id:ngtkana:20200827114036p:plain

2020-08-27

1 / 37 島はいくつある?

どうやら repeat_with はなかったようですね。

error[E0432]: unresolved import `std::iter::repeat_with`

contains もないのですか!?

error: use of unstable library feature 'range_contains'

AC です。

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4797692#1

グリッドさん、やはり型変換がかなりつらいです。ライブラリ化してもよいかもです。

for (ni, nj) in GRID_EIGHT_DIRS_I32
    .iter()
    .map(|&(di, dj)| {
        let ni = i as i32 + di;
        let nj = j as i32 + dj;
        (ni, nj)
    })
    .filter(|&(ni, nj)| {
        0 <= ni && ni < h as i32 && 0 <= nj && nj < w as i32
    })
    .map(|(ni, nj)| (ni as usize, nj as usize))

というわけでつくりました。

for (ni, nj) in
    GRID_EIGHT_DIRS_I64
        .iter()
        .map(|&x| x)
        .grid_next((i, j), h, w)

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4797807#1

パラメータパターンマッチもないのですね。

Compile Error Logs:
error: expected one of `+` or `,`, found `:` --> rep/code.rs:101:34 | 101 | fn grid_next(self, (i, j): (usize, usize), h: usize, w: usize) -> GridNext | ^ 

2 / 37 Red and Black

早速グリッドの問題が出ましたから、上記のようにライブラリ追加するをしました。

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4797906#1

3 / 37 チェビシェフの定理

http://judge.u-aizu.ac.jp/onlinejudge/user.jsp?id=mozuku5#1

seq::step を追加して、seq をリファクタしました。

  • ルートモジュール以外で std を使うときには ::std が必要?
  • use adjacent::adjacent はだめで、use self::adjacent::adjacent で通ります。(むーん)

かなり書きやすくなった気がします。篩もいつかライブラリにしてもよいかもです。(いまはまだかなのきもちです。)

for i in seq::step(2 * p, p).take_while(|&x| x < SIZE) {

4 / 37 世界の天秤

インデント波動拳です。

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4799214#1

5 / 37 ディリクレの算術級数定理

seq::step を 2 回も使いました。作ってよかったです。

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4799220#1

6 / 37 角角画伯,かく悩みき

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4799421

7 / 37 宇宙ヤシガニ

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4799465

8 / 37 Numeral System

http://judge.u-aizu.ac.jp/onlinejudge/submission.jsp#

9 / 37 Amida, the City of Miracle (☆)

なるほどです。イテレータカテゴリー的系でだめなのはこれだけのようですね。

error: use of unstable library feature 'fused' (see issue #35602

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4802180#1

10 / 37 整長方形

2020-08-28

11 / 37 繰り返す10進数

そんな‥‥、素敵な機能なのに。

error: `break` with a value is experimental 

12 / 37 お姫様の嫁入り

なるほど std::cmp::min は 1.21.0 からなのですね。

error: no method named `min` found for type `u64` in the current scope 

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4802282#1

13 / 37 Make Purse Light

テストケース空行区切りなるほどです。

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4802901#1

14 / 37 ICPCの順位付け

これ類題多くありませんか?

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4802941#1

15 / 37 君のプライバシーを守れ!

素敵な機能だったのですが、できないのですね。

error: slice pattern syntax is experimental

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4802959#1

16 / 37 Matsuzaki 数

rfold って 1.27.0 からなのですね。

error[E0407]: method `rfold` is not a member of trait `DoubleEndedIterator`

impl trait もないようですね。

error: `impl Trait` is experimental (see issue #34511) --> rep/code.rs:94:38

pub(super) などもつかえないようです。

error: `pub(restricted)` syntax is experimental (see issue #32409) `

なんだかいろいろハマってしまいましたが、AC です。

http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4803220#1