結果
| 問題 | No.2547 Did you enjoy Chofu Festival? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-10 10:32:42 |
| 言語 | Rust (1.94.0 + proconio + num + itertools) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 393 bytes |
| 記録 | |
| コンパイル時間 | 720 ms |
| コンパイル使用メモリ | 144,092 KB |
| 最終ジャッジ日時 | 2026-05-27 07:55:02 |
| 合計ジャッジ時間 | 1,778 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
error: cannot explicitly dereference within an implicitly-borrowing pattern --> src/main.rs:9:42 | 9 | let c = a.iter().zip(b.iter()).filter(|(&a, &b)| a <= b).count(); | ^ ^ reference pattern not allowed when implicitly borrowing | | | reference pattern not allowed when implicitly borrowing | = note: for more information, see <https://doc.rust-lang.org/reference/patterns.html#binding-modes> note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> src/main.rs:9:41 | 9 | let c = a.iter().zip(b.iter()).filter(|(&a, &b)| a <= b).count(); | ^^^^^^^^ this non-reference pattern matches on a reference type `&_` help: match on the reference with a reference pattern to avoid implicitly borrowing | 9 | let c = a.iter().zip(b.iter()).filter(|&(&a, &b)| a <= b).count(); | + error: could not compile `main` (bin "main") due to 1 previous error
ソースコード
use std::io::Read;
fn main() {
let mut s = String::new();
std::io::stdin().read_to_string(&mut s).ok();
let s: Vec<_> = s.trim().split('\n').collect();
let a: Vec<u8> = s[1].split_whitespace().flat_map(str::parse).collect();
let b: Vec<u8> = s[2].split_whitespace().flat_map(str::parse).collect();
let c = a.iter().zip(b.iter()).filter(|(&a, &b)| a <= b).count();
println!("{}", c);
}