結果
問題 | No.2594 Mix shake!! |
ユーザー | akakimidori |
提出日時 | 2023-12-22 20:34:55 |
言語 | Rust (1.77.0 + proconio) |
結果 |
RE
|
実行時間 | - |
コード長 | 3,048 bytes |
コンパイル時間 | 13,601 ms |
コンパイル使用メモリ | 403,380 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-27 11:27:47 |
合計ジャッジ時間 | 16,209 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | RE | - |
testcase_05 | AC | 1 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,944 KB |
testcase_07 | RE | - |
testcase_08 | AC | 1 ms
6,944 KB |
testcase_09 | AC | 1 ms
6,944 KB |
testcase_10 | AC | 1 ms
6,940 KB |
testcase_11 | RE | - |
testcase_12 | AC | 1 ms
6,944 KB |
testcase_13 | AC | 2 ms
6,944 KB |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | AC | 1 ms
6,940 KB |
testcase_17 | AC | 1 ms
6,940 KB |
testcase_18 | AC | 1 ms
6,940 KB |
testcase_19 | AC | 1 ms
6,944 KB |
testcase_20 | AC | 1 ms
6,944 KB |
testcase_21 | RE | - |
testcase_22 | AC | 1 ms
6,940 KB |
testcase_23 | AC | 1 ms
6,940 KB |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | AC | 1 ms
6,940 KB |
testcase_33 | AC | 1 ms
6,940 KB |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | RE | - |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | RE | - |
testcase_45 | RE | - |
testcase_46 | RE | - |
testcase_47 | RE | - |
testcase_48 | RE | - |
testcase_49 | RE | - |
testcase_50 | RE | - |
testcase_51 | RE | - |
testcase_52 | RE | - |
testcase_53 | RE | - |
testcase_54 | AC | 1 ms
6,944 KB |
testcase_55 | AC | 1 ms
6,944 KB |
testcase_56 | AC | 1 ms
6,940 KB |
testcase_57 | RE | - |
testcase_58 | AC | 1 ms
6,944 KB |
testcase_59 | RE | - |
testcase_60 | AC | 1 ms
6,940 KB |
testcase_61 | RE | - |
testcase_62 | AC | 1 ms
6,944 KB |
testcase_63 | RE | - |
testcase_64 | AC | 1 ms
6,940 KB |
testcase_65 | RE | - |
testcase_66 | AC | 1 ms
6,940 KB |
testcase_67 | AC | 1 ms
6,944 KB |
testcase_68 | AC | 1 ms
6,944 KB |
testcase_69 | AC | 1 ms
6,944 KB |
testcase_70 | AC | 1 ms
6,940 KB |
testcase_71 | AC | 1 ms
6,940 KB |
testcase_72 | AC | 1 ms
6,940 KB |
testcase_73 | AC | 1 ms
6,940 KB |
testcase_74 | AC | 1 ms
6,944 KB |
testcase_75 | AC | 1 ms
6,944 KB |
testcase_76 | AC | 1 ms
6,940 KB |
testcase_77 | AC | 1 ms
6,944 KB |
testcase_78 | AC | 1 ms
6,944 KB |
testcase_79 | AC | 1 ms
6,944 KB |
testcase_80 | AC | 1 ms
6,940 KB |
testcase_81 | AC | 1 ms
6,940 KB |
testcase_82 | AC | 1 ms
6,940 KB |
testcase_83 | AC | 1 ms
6,944 KB |
testcase_84 | AC | 1 ms
6,940 KB |
testcase_85 | AC | 1 ms
6,940 KB |
testcase_86 | AC | 1 ms
6,940 KB |
testcase_87 | AC | 1 ms
6,940 KB |
コンパイルメッセージ
warning: unused import: `std::io::Write` --> src/main.rs:1:5 | 1 | use std::io::Write; | ^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: type alias `Map` is never used --> src/main.rs:4:6 | 4 | type Map<K, V> = BTreeMap<K, V>; | ^^^ | = note: `#[warn(dead_code)]` on by default warning: type alias `Set` is never used --> src/main.rs:5:6 | 5 | type Set<T> = BTreeSet<T>; | ^^^ warning: type alias `Deque` is never used --> src/main.rs:6:6 | 6 | type Deque<T> = VecDeque<T>; | ^^^^^
ソースコード
use std::io::Write; use std::collections::*; type Map<K, V> = BTreeMap<K, V>; type Set<T> = BTreeSet<T>; type Deque<T> = VecDeque<T>; fn main() { input! { n: usize, a: [i128; n], b: [i128; n], c: [i128; n], d: [i128; n], } let ans = if solve(a, b, c, d) { "Yes" } else { "No" }; println!("{}", ans); } fn solve(a: Vec<i128>, b: Vec<i128>, c: Vec<i128>, d: Vec<i128>) -> bool { let p = a.into_iter().zip(b).collect::<Vec<_>>(); let q = c.into_iter().zip(d).collect::<Vec<_>>(); if !yokohama(p.clone(), q.clone()) { return false; } for i in 0..p.len() { for j in 0..i { let mut p = p.clone(); let v = p.remove(i); p[j].0 += v.0; p[j].1 += v.1; if yokohama(p.clone(), q.clone()) { return true; } } } todo!() } fn yokohama(mut p: Vec<(i128, i128)>, mut q: Vec<(i128, i128)>) -> bool { p.sort_by(|a, b| (a.0 * b.1 - a.1 * b.0).cmp(&0)); q.sort_by(|a, b| (a.0 * b.1 - a.1 * b.0).cmp(&0)); p.insert(0, (0, 0)); for i in 1..p.len() { p[i].0 += p[i - 1].0; p[i].1 += p[i - 1].1; } let mut x = 0; let mut y = 0; let mut pos = 0; for q in q.iter() { x += q.0; y += q.1; while x > p[pos + 1].0 { pos += 1; } let s = p[pos]; let t = p[pos + 1]; if (y - s.1) * (t.0 - s.0) > (t.1 - s.1) * (x - s.0) { return false; } } true } // ---------- begin input macro ---------- // reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 #[macro_export] macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); input_inner!{iter, $($r)*} }; ($($r:tt)*) => { let s = { use std::io::Read; let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); s }; let mut iter = s.split_whitespace(); input_inner!{iter, $($r)*} }; } #[macro_export] macro_rules! input_inner { ($iter:expr) => {}; ($iter:expr, ) => {}; ($iter:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($iter, $t); input_inner!{$iter $($r)*} }; } #[macro_export] macro_rules! read_value { ($iter:expr, ( $($t:tt),* )) => { ( $(read_value!($iter, $t)),* ) }; ($iter:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>() }; ($iter:expr, chars) => { read_value!($iter, String).chars().collect::<Vec<char>>() }; ($iter:expr, bytes) => { read_value!($iter, String).bytes().collect::<Vec<u8>>() }; ($iter:expr, usize1) => { read_value!($iter, usize) - 1 }; ($iter:expr, $t:ty) => { $iter.next().unwrap().parse::<$t>().expect("Parse error") }; } // ---------- end input macro ----------