Skip to content

Instantly share code, notes, and snippets.

@nak3
Created December 11, 2017 13:36
Show Gist options
  • Save nak3/15fdcf8d3f76775e007d5195e3564d4d to your computer and use it in GitHub Desktop.
Save nak3/15fdcf8d3f76775e007d5195e3564d4d to your computer and use it in GitHub Desktop.
use std::io::*;
use std::str::*;
//const MOD: i32 = 1000000007;
fn read<T: FromStr>() -> Option<T> {
let stdin = stdin();
let s = stdin
.bytes()
.map(|c| c.unwrap() as char)
.take_while(|c| !c.is_whitespace())
.collect::<String>();
s.parse::<T>().ok()
}
fn main() {
let n: usize = read().unwrap();
let mut m: [[usize; 100]; 100] = [[0; 100]; 100];
for _ in 0..n {
let mut u: usize = read().unwrap();
let mut k: usize = read().unwrap();
u -= 1;
for _ in 0..k {
let mut tmp: usize = read().unwrap();
tmp -= 1;
m[u][tmp] = 1;
}
}
for i in 0..n {
for j in 0..n {
if j >= 1 {
print!(" ");
}
print!("{}", m[i][j]);
}
println!("");
}
}
/*
4
1 2 2 4
2 1 4
3 0
4 1 3
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment