Submission #1048404


Source Code Expand

M=10**9+7;N=gets.to_i;G=(0..N).map{[]};$<.map{|_|a,b=_.split.map &:to_i;G[a]<<b;G[b]<<a};F=->x,y{w=b=1;G[x].each{|e|(c,d=F[e,x];w=w*(c+d)%M;b*=c)if e!=y};[w,b]};w,b=F[1,0];p (w+b)%M

Submission Info

Submission Time
Task D - 塗り絵
User leafmoon
Language Ruby (2.3.3)
Score 100
Code Size 181 Byte
Status AC
Exec Time 245 ms
Memory 13180 KB

Compile Error

./Main.rb:1: warning: `&' interpreted as argument prefix

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 22
Set Name Test Cases
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt
Case Name Status Exec Time Memory
000.txt AC 11 ms 1788 KB
001.txt AC 11 ms 1788 KB
002.txt AC 176 ms 11900 KB
003.txt AC 224 ms 12924 KB
004.txt AC 148 ms 10620 KB
005.txt AC 216 ms 13180 KB
006.txt AC 199 ms 12540 KB
007.txt AC 218 ms 12924 KB
008.txt AC 158 ms 11260 KB
009.txt AC 218 ms 12796 KB
010.txt AC 164 ms 11388 KB
011.txt AC 217 ms 12540 KB
012.txt AC 131 ms 8372 KB
013.txt AC 245 ms 12924 KB
014.txt AC 110 ms 8060 KB
015.txt AC 226 ms 13052 KB
016.txt AC 139 ms 10364 KB
017.txt AC 222 ms 12796 KB
018.txt AC 48 ms 4604 KB
019.txt AC 217 ms 12924 KB
020.txt AC 32 ms 3324 KB
021.txt AC 223 ms 12924 KB