結果

問題 No.91 赤、緑、青の石
ユーザー tanimani364
提出日時 2021-03-29 16:31:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 608 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 82,104 KB
実行使用メモリ 67,600 KB
最終ジャッジ日時 2024-06-24 07:31:53
合計ジャッジ時間 3,141 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
#coding:utf-8

import math
import string
import random
import heapq
from sys import stdin
# import numpy as np
# from matplotlib import pyplot as plt
	

def main():
	read=stdin.readline

	#edit here!
	a=list(map(int,read().split()))
	a.sort()
	maxv=10000001
	l=0
	r=maxv
	while r-l>1:
		mid=(l+r)//2
		if a[-1]<mid:
			r=mid;
		elif a[-1]>=mid and a[1]<mid:
			num=(a[-1]-mid)//2
			if num >=mid-a[1]+mid-a[0]:
				l=mid
			else :
				r=mid
		else:
			num=(a[-1]-mid)//2+(a[1]-mid)//2
			if num>=mid-a[0]:
				l=mid;
			else:
				r=mid
	print(l)




if __name__ == '__main__':
	main()
0