Submission #1560222
Source Code Expand
use std::io; use std::io::{Read, BufReader}; macro_rules! read { ( $( $t:ty ),* ) => { { let mut buf = String::new(); io::stdin().read_line(&mut buf); let mut sp = buf.trim().split(" "); ($( { sp.next().unwrap().parse::<$t>().unwrap() }, )*) } } } macro_rules! read_vec { ($t:ty) => { { let mut buf = String::new(); io::stdin().read_line(&mut buf); let mut sp = buf.trim().split(" "); let mut ret = vec![]; for s in sp { ret.push(s.parse::<$t>().unwrap()); } ret } } } const MOD: i64 = 998244353; fn line(a: (i64, i64), b: (i64, i64), c: (i64, i64)) -> bool { let b = (b.0 - a.0, b.1 - a.1); let c = (c.0 - a.0, c.1 - a.1); b.1 * c.0 == b.0 * c.1 } fn ctri(ni: i64) -> i64 { let mut ret = 1i64; for _ in 0..ni { ret = ret * 2 % MOD; } ret = (ret + MOD - 1) % MOD; ret = (ret + MOD - ni) % MOD; ret = (ret + MOD - ni * (ni - 1) / 2) % MOD; ret } fn main() { let (n,) = read!(usize); let mut pts = vec![]; for _ in 0..n { pts.push(read!(i64, i64)); } let mut lin = vec![0i64; n + 1]; for i in 0..n { for j in (i + 1)..n { let mut cnt = 0; for k in 0..n { if line(pts[i], pts[j], pts[k]) { cnt += 1 } } lin[cnt] += 1 } } let mut ret = 1i64; for _ in 0..n { ret = ret * 2 % MOD; } let ni = n as i64; ret = ctri(ni); for i in 3..(n + 1) { let act = lin[i] / ((i * (i - 1) / 2) as i64); ret = (ret + MOD - ctri(i as i64) * act % MOD) % MOD; } println!("{}", ret); }
Submission Info
Submission Time | |
---|---|
Task | E - ConvexScore |
User | semiexp |
Language | Rust (1.15.1) |
Score | 700 |
Code Size | 1982 Byte |
Status | AC |
Exec Time | 14 ms |
Memory | 4352 KB |
Compile Error
warning: unused imports: `BufReader`, `Read`, #[warn(unused_imports)] on by default --> ./Main.rs:2:15 | 2 | use std::io::{Read, BufReader}; | ^^^^ ^^^^^^^^^ warning: unused result which must be used, #[warn(unused_must_use)] on by default --> ./Main.rs:8:13 | 8 | io::stdin().read_line(&mut buf); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 56 | let (n,) = read!(usize); | ------------ in this macro invocation warning: unused result which must be used, #[warn(unused_must_use)] on by default --> ./Main.rs:8:13 | 8 | io::stdin().read_line(&mut buf); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 59 | pts.push(read!(i64, i64)); | --------------- in this macro invocation
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 700 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt, 1_028.txt, 1_029.txt, 1_030.txt, 1_031.txt, 1_032.txt, 1_033.txt, 1_034.txt, 1_035.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 2 ms | 4352 KB |
0_001.txt | AC | 2 ms | 4352 KB |
0_002.txt | AC | 2 ms | 4352 KB |
1_003.txt | AC | 2 ms | 4352 KB |
1_004.txt | AC | 2 ms | 4352 KB |
1_005.txt | AC | 5 ms | 4352 KB |
1_006.txt | AC | 2 ms | 4352 KB |
1_007.txt | AC | 8 ms | 4352 KB |
1_008.txt | AC | 6 ms | 4352 KB |
1_009.txt | AC | 6 ms | 4352 KB |
1_010.txt | AC | 3 ms | 4352 KB |
1_011.txt | AC | 7 ms | 4352 KB |
1_012.txt | AC | 8 ms | 4352 KB |
1_013.txt | AC | 5 ms | 4352 KB |
1_014.txt | AC | 2 ms | 4352 KB |
1_015.txt | AC | 8 ms | 4352 KB |
1_016.txt | AC | 4 ms | 4352 KB |
1_017.txt | AC | 14 ms | 4352 KB |
1_018.txt | AC | 14 ms | 4352 KB |
1_019.txt | AC | 14 ms | 4352 KB |
1_020.txt | AC | 14 ms | 4352 KB |
1_021.txt | AC | 14 ms | 4352 KB |
1_022.txt | AC | 14 ms | 4352 KB |
1_023.txt | AC | 14 ms | 4352 KB |
1_024.txt | AC | 14 ms | 4352 KB |
1_025.txt | AC | 14 ms | 4352 KB |
1_026.txt | AC | 14 ms | 4352 KB |
1_027.txt | AC | 14 ms | 4352 KB |
1_028.txt | AC | 14 ms | 4352 KB |
1_029.txt | AC | 14 ms | 4352 KB |
1_030.txt | AC | 14 ms | 4352 KB |
1_031.txt | AC | 14 ms | 4352 KB |
1_032.txt | AC | 14 ms | 4352 KB |
1_033.txt | AC | 14 ms | 4352 KB |
1_034.txt | AC | 14 ms | 4352 KB |
1_035.txt | AC | 14 ms | 4352 KB |