提出 #49584480
ソースコード 拡げる
use proconio::input;
fn main() {
input! {
n: usize,
m: usize,
a: [usize; m],
};
let mut c = vec![0; n];
let mut ans = vec![];
for a_i in a {
if c[0] < a_i {
c[0] = a_i;
ans.push(0);
continue;
}
let mut ok = 0;
let mut ng = n;
while ng - ok > 1 {
let mid = (ok + ng) / 2;
if c[mid] >= a_i {
ok = mid;
} else {
ng = mid;
}
}
if ng == n {
ans.push(-1);
} else {
c[ng] = a_i;
ans.push(ng as i64);
}
}
for a in ans {
println!("{}", if a == -1 { -1 } else { a + 1 });
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | J - 回転寿司 |
| ユーザ | bouzuya |
| 言語 | Rust (rustc 1.70.0) |
| 得点 | 6 |
| コード長 | 756 Byte |
| 結果 | AC |
| 実行時間 | 290 ms |
| メモリ | 10508 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 6 / 6 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, max_01.txt, max_02.txt, max_03.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, sample_01.txt, sample_02.txt, sample_03.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| hand_01.txt | AC | 265 ms | 8644 KiB |
| hand_02.txt | AC | 280 ms | 10440 KiB |
| hand_03.txt | AC | 285 ms | 10184 KiB |
| hand_04.txt | AC | 290 ms | 10508 KiB |
| hand_05.txt | AC | 286 ms | 10080 KiB |
| max_01.txt | AC | 287 ms | 9684 KiB |
| max_02.txt | AC | 285 ms | 9428 KiB |
| max_03.txt | AC | 285 ms | 9640 KiB |
| random_01.txt | AC | 161 ms | 6220 KiB |
| random_02.txt | AC | 1 ms | 1980 KiB |
| random_03.txt | AC | 231 ms | 8120 KiB |
| random_04.txt | AC | 29 ms | 2792 KiB |
| random_05.txt | AC | 196 ms | 7132 KiB |
| random_06.txt | AC | 217 ms | 7684 KiB |
| random_07.txt | AC | 265 ms | 8976 KiB |
| random_08.txt | AC | 182 ms | 6756 KiB |
| sample_01.txt | AC | 1 ms | 2052 KiB |
| sample_02.txt | AC | 1 ms | 2160 KiB |
| sample_03.txt | AC | 1 ms | 1928 KiB |