Submission #19514240


Source Code Expand

Copy
import math
mod=10**9+7
n=int(input())
P=dict()
M=dict()
for _ in range(n):
    a,b=map(int,input().split())
    g=math.gcd(a,b)
    a,b=a//g,b//g
    if a*b<0:
        p=(abs(b),abs(a))
        if p in M:
            M[p]+=1
        else:
            M[p]=1
    else:
        p=(a,b)
        if p in P:
            P[p]+=1
        else:
            P[p]=1
D_pow=dict()
def my_pow(k):
    if k in D_pow:
        return D_pow[k]
    else:
        D_pow[k]=pow(2,k,mod)
        return D_pow[k]
ans=1
for k in P.keys():
    if k in M:
        tmp=my_pow(P[k])+my_pow(M[k])-1
        tmp%=mod
        ans*=tmp
        ans%=mod
        M[k]=0
    else:
        ans*=my_pow(P[k])
        ans%=mod
for v in M.values():
    ans*=my_pow(v)
    ans%=mod
print(ans-1)

Submission Info

Submission Time
Task E - ∙ (Bullet)
User bis
Language PyPy3 (7.3.0)
Score 0
Code Size 798 Byte
Status RE
Exec Time 519 ms
Memory 116768 KB

Judge Result

Set Name Sample Subtask1
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 13
WA × 2
RE × 8
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
Subtask1 sample_01.txt, sample_02.txt, sub1_01.txt, sub1_02.txt, sub1_03.txt, sub1_04.txt, sub1_05.txt, sub1_06.txt, sub1_07.txt, sub1_08.txt, sub1_09.txt, sub1_10.txt, sub1_11.txt, sub1_12.txt, sub1_13.txt, sub1_14.txt, sub1_15.txt, sub1_16.txt, sub1_17.txt, sub1_18.txt, sub1_19.txt, sub1_20.txt, sub1_21.txt
Case Name Status Exec Time Memory
sample_01.txt AC 109 ms 61340 KB
sample_02.txt AC 53 ms 61320 KB
sub1_01.txt AC 519 ms 116768 KB
sub1_02.txt RE 92 ms 67940 KB
sub1_03.txt AC 59 ms 61816 KB
sub1_04.txt AC 54 ms 61764 KB
sub1_05.txt AC 52 ms 61920 KB
sub1_06.txt AC 52 ms 61936 KB
sub1_07.txt AC 52 ms 61732 KB
sub1_08.txt AC 52 ms 61944 KB
sub1_09.txt AC 53 ms 61680 KB
sub1_10.txt AC 52 ms 61820 KB
sub1_11.txt RE 73 ms 68644 KB
sub1_12.txt RE 115 ms 70692 KB
sub1_13.txt RE 179 ms 72496 KB
sub1_14.txt RE 79 ms 67980 KB
sub1_15.txt RE 81 ms 68364 KB
sub1_16.txt RE 78 ms 67936 KB
sub1_17.txt WA 253 ms 70164 KB
sub1_18.txt WA 346 ms 69740 KB
sub1_19.txt AC 162 ms 75344 KB
sub1_20.txt AC 292 ms 92212 KB
sub1_21.txt RE 75 ms 68112 KB