Submission #3609823
Source Code Expand
def ge(k,array,ind):
return array[ind]>=k
def lower_bound(k, array, func=ge):
"""
k 以上を満たす最小のインデックスを返す
もしなかったら要素数を返す
"""
lb=-1
ub=len(array)
while ub-lb>1:
mid = (lb+ub)//2
if func(k,array,mid):
ub=mid
else:
lb=mid
return ub
def lt(k,array,ind):
return array[ind]<k
def upper_bound(k, array, func=lt):
"""
k 未満を満たす最大のインデックスを返す
もしなかったら-1を返す
"""
lb=-1
ub=len(array)
while ub-lb>1:
mid = (lb+ub)//2
if func(k,array,mid):
lb=mid
else:
ub=mid
return ub-1
def main():
l = int(input())
ans = []
array = [i for i in range(60)]
ind = upper_bound(l, array, lambda k,array,mid:2**mid<=k)
r = array[ind]
n = r+1
for i in range(1,n):
ans.append((i,i+1,0))
ans.append((i,i+1,2**i))
for t in range(n-1,0,-1):
if l-2**t>=2**r:
ans.append((t,n,l-2**(t-1)))
l-=2**(t-1)
print(n,len(ans))
for f,t,c in ans:
print(f,t,c)
if __name__ == '__main__':
main()
Submission Info
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 700 |
Status |
|
|
Set Name |
Test Cases |
Sample |
s1.txt, s2.txt |
All |
01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, s1.txt, s2.txt |
Case Name |
Status |
Exec Time |
Memory |
01.txt |
WA |
17 ms |
3064 KB |
02.txt |
WA |
17 ms |
3064 KB |
03.txt |
WA |
17 ms |
3064 KB |
04.txt |
WA |
17 ms |
3064 KB |
05.txt |
WA |
17 ms |
3064 KB |
06.txt |
WA |
17 ms |
3064 KB |
07.txt |
WA |
17 ms |
3064 KB |
08.txt |
WA |
17 ms |
3064 KB |
09.txt |
WA |
17 ms |
3064 KB |
10.txt |
WA |
17 ms |
3064 KB |
11.txt |
WA |
17 ms |
3064 KB |
12.txt |
WA |
17 ms |
3064 KB |
13.txt |
WA |
17 ms |
3064 KB |
14.txt |
WA |
18 ms |
3064 KB |
15.txt |
WA |
17 ms |
3064 KB |
16.txt |
WA |
17 ms |
3064 KB |
17.txt |
WA |
18 ms |
3064 KB |
18.txt |
WA |
17 ms |
3064 KB |
19.txt |
WA |
17 ms |
3064 KB |
20.txt |
WA |
17 ms |
3064 KB |
s1.txt |
WA |
17 ms |
3064 KB |
s2.txt |
WA |
17 ms |
3064 KB |