Submission #1839591


Source Code Expand

N,M=map(int,input().split())

res=-1
left=0
right=M

while left < right:
	mid1 = (2*left + right)//3
	mid2 = (left + 2*right)//3
	m1=mid1//2
	m2=mid2//2
	curr1 = min(m1+N, M//2-m1)
	curr2 = min(m2+N, M//2-m2)
	if curr1 < curr2:
		left=mid1
	elif curr1 > curr2:
		right=mid2
	else:
		res=mid1
		break

res=(left if res == -1 else res)
print(res)	

Submission Info

Submission Time
Task C - Scc Puzzle
User ty70
Language Python (3.4.3)
Score 0
Code Size 367 Byte
Status WA
Exec Time 17 ms
Memory 3064 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 1
WA × 1
AC × 2
WA × 7
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt
All 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt
Case Name Status Exec Time Memory
00_example_01.txt AC 17 ms 3060 KB
00_example_02.txt WA 17 ms 3064 KB
01.txt WA 17 ms 3060 KB
02.txt WA 17 ms 3064 KB
03.txt AC 17 ms 3060 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