# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
551420 |
2022-04-20T15:45:54 Z |
jh05013 |
None (KRIII5P_3) |
Python 3 |
|
15 ms |
2900 KB |
import sys;input=lambda:sys.stdin.readline().strip('\n')
MIS = lambda: map(int,input().split())
n = int(input())
ev_l = {}
ev_r = {}
for i in range(n):
l, r = MIS()
ev_l[l] = ev_l.get(l, 0) + 1
ev_r[r] = ev_r.get(r, 0) + 1
pnts = sorted(set(list(ev_l.keys()) + list(ev_r.keys())))
ans0 = ans1 = 0
lay = 0
for i in range(len(pnts)-1):
l, r = pnts[i], pnts[i+1]
lay-= ev_r.get(l, 0)
lay_old = lay
lay+= ev_l.get(l, 0)
ans0+= (2**lay-1) * (r-l)
ans1+= 2**lay - 2**lay_old
print(ans0, ans1)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
2900 KB |
Expected integer, but "529098958053799708116111981339...8280087146317355599758278398918" found |
2 |
Halted |
0 ms |
0 KB |
- |