提出 #70988924
ソースコード 拡げる
use std::io::{Read, Write};
fn main() {
let out = std::io::stdout();
let mut out = std::io::BufWriter::new(out.lock());
let mut input = String::new();
std::io::stdin().read_to_string(&mut input).unwrap();
let mut iter = input.split_ascii_whitespace();
let n: i64 =iter.next().unwrap().parse().unwrap();
let x: i64 =iter.next().unwrap().parse().unwrap();
let y: i64 =iter.next().unwrap().parse().unwrap();
let mut a: Vec<i64> = (0..n).map(|_| iter.next().unwrap().parse().unwrap()).collect();
let mut ans = 0i64;
a.sort_by(|a,b| b.cmp(a));
let mut success = true;
for m in (0..=(a[0]*y)).rev() {
success = true;
ans=0;
for &ai in &a {
let mut ok = false;
for yi in (0..=ai).rev() {
if y*yi+x*(ai-yi) == m && ai-yi>=0 {
ok = true;
ans += yi;
break;
}
}
if !ok {
success=false;
break;
}
}
if success{
break;
}
}
if success {
writeln!(out, "{}", ans).unwrap();
} else {
writeln!(out, "-1").unwrap();
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - Candy Tribulation |
| ユーザ | akatsuki7c8 |
| 言語 | Rust (rustc 1.89.0) |
| 得点 | 0 |
| コード長 | 1282 Byte |
| 結果 | TLE |
| 実行時間 | > 2000 ms |
| メモリ | 7152 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 350 | ||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt |
| All | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt, 01-36.txt, 01-37.txt, 01-38.txt, 01-39.txt, 01-40.txt, 01-41.txt, 01-42.txt, 01-43.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00-sample-01.txt | AC | 1 ms | 1916 KiB |
| 00-sample-02.txt | AC | 1 ms | 1968 KiB |
| 00-sample-03.txt | AC | 1 ms | 1976 KiB |
| 01-01.txt | TLE | > 2000 ms | 4432 KiB |
| 01-02.txt | TLE | > 2000 ms | 2500 KiB |
| 01-03.txt | TLE | > 2000 ms | 4948 KiB |
| 01-04.txt | TLE | > 2000 ms | 5356 KiB |
| 01-05.txt | AC | 3 ms | 3844 KiB |
| 01-06.txt | AC | 6 ms | 5600 KiB |
| 01-07.txt | AC | 6 ms | 5436 KiB |
| 01-08.txt | TLE | > 2000 ms | 7076 KiB |
| 01-09.txt | TLE | > 2000 ms | 7036 KiB |
| 01-10.txt | TLE | > 2000 ms | 7008 KiB |
| 01-11.txt | TLE | > 2000 ms | 7000 KiB |
| 01-12.txt | TLE | > 2000 ms | 7100 KiB |
| 01-13.txt | TLE | > 2000 ms | 5600 KiB |
| 01-14.txt | TLE | > 2000 ms | 7084 KiB |
| 01-15.txt | TLE | > 2000 ms | 7084 KiB |
| 01-16.txt | TLE | > 2000 ms | 6508 KiB |
| 01-17.txt | TLE | > 2000 ms | 7064 KiB |
| 01-18.txt | TLE | > 2000 ms | 7016 KiB |
| 01-19.txt | TLE | > 2000 ms | 6424 KiB |
| 01-20.txt | TLE | > 2000 ms | 7100 KiB |
| 01-21.txt | TLE | > 2000 ms | 7072 KiB |
| 01-22.txt | TLE | > 2000 ms | 6620 KiB |
| 01-23.txt | TLE | > 2000 ms | 7008 KiB |
| 01-24.txt | TLE | > 2000 ms | 7072 KiB |
| 01-25.txt | TLE | > 2000 ms | 5980 KiB |
| 01-26.txt | TLE | > 2000 ms | 4700 KiB |
| 01-27.txt | TLE | > 2000 ms | 6424 KiB |
| 01-28.txt | TLE | > 2000 ms | 5596 KiB |
| 01-29.txt | TLE | > 2000 ms | 7124 KiB |
| 01-30.txt | TLE | > 2000 ms | 7072 KiB |
| 01-31.txt | TLE | > 2000 ms | 5228 KiB |
| 01-32.txt | TLE | > 2000 ms | 7072 KiB |
| 01-33.txt | TLE | > 2000 ms | 6908 KiB |
| 01-34.txt | TLE | > 2000 ms | 5964 KiB |
| 01-35.txt | TLE | > 2000 ms | 7152 KiB |
| 01-36.txt | TLE | > 2000 ms | 6984 KiB |
| 01-37.txt | TLE | > 2000 ms | 4668 KiB |
| 01-38.txt | TLE | > 2000 ms | 7116 KiB |
| 01-39.txt | TLE | > 2000 ms | 7076 KiB |
| 01-40.txt | TLE | > 2000 ms | 6020 KiB |
| 01-41.txt | TLE | > 2000 ms | 5768 KiB |
| 01-42.txt | TLE | > 2000 ms | 5000 KiB |
| 01-43.txt | TLE | > 2000 ms | 6996 KiB |