Submission #19514227


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)
print(ans-1)

Submission Info

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

Judge Result

Set Name Sample Subtask1
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 10
WA × 5
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 62 ms 62332 KB
sample_02.txt AC 46 ms 62392 KB
sub1_01.txt WA 678 ms 117544 KB
sub1_02.txt RE 69 ms 68432 KB
sub1_03.txt AC 54 ms 62288 KB
sub1_04.txt AC 46 ms 62240 KB
sub1_05.txt AC 52 ms 62300 KB
sub1_06.txt AC 51 ms 62124 KB
sub1_07.txt AC 51 ms 62284 KB
sub1_08.txt AC 51 ms 62128 KB
sub1_09.txt AC 43 ms 62268 KB
sub1_10.txt AC 53 ms 62228 KB
sub1_11.txt RE 74 ms 68908 KB
sub1_12.txt RE 106 ms 71204 KB
sub1_13.txt RE 171 ms 72872 KB
sub1_14.txt RE 73 ms 68704 KB
sub1_15.txt RE 75 ms 68660 KB
sub1_16.txt RE 77 ms 68332 KB
sub1_17.txt WA 248 ms 70504 KB
sub1_18.txt WA 333 ms 70080 KB
sub1_19.txt WA 160 ms 75720 KB
sub1_20.txt WA 329 ms 92728 KB
sub1_21.txt RE 70 ms 68484 KB