| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1281684 | hardrun | Jakarta Skyscrapers (APIO15_skyscraper) | Pypy 3 | 144 ms | 48860 KiB |
N,M=map(int, input().split())
l=[]
t=[]
for i in range(M):
b,p=map(int, input().split())
l.append(b)
t.append(p)
if M==2:
if abs(l[0]-l[1])%t[0]!=0:
print(-1)
else:
print(int(abs(l[0]-l[1])//(t[0])))
else:
if abs(l[0]-l[1])%t[0]!=0 and abs(l[0]-l[2])%t[0]!=0:
print(-1)
elif abs(l[0]-l[1])%t[0]!=0 and abs(l[0]-l[2])%t[0]==0 and abs(l[2]-l[1])%t[2]!=0:
print(-1)
elif abs(l[0]-l[1])%t[0]!=0 and abs(l[0]-l[2])%t[0]==0 and abs(l[2]-l[1])%t[2]==0:
print(int(abs(l[0]-l[2])//t[0])+int(abs(l[2]-l[1])//t[2]))
else:
print(min(int(abs(l[0]-l[1])//t[0]),int(abs(l[0]-l[2])//t[0])+int(abs(l[2]-l[1])//t[2])))
Compilation message (stdout)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
