結果
問題 | No.2493 K-th in L2 with L1 |
ユーザー |
![]() |
提出日時 | 2023-10-06 22:15:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 106 ms / 2,000 ms |
コード長 | 1,255 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 82,444 KB |
実行使用メモリ | 80,640 KB |
最終ジャッジ日時 | 2024-07-26 16:29:44 |
合計ジャッジ時間 | 1,478 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 |
ソースコード
from collections import defaultdict, deque, Counterimport copyfrom itertools import combinations, permutations, product, accumulate, groupby, chainfrom heapq import heapify, heappop, heappushimport mathimport bisectfrom pprint import pprintfrom random import randintimport sys# sys.setrecursionlimit(700000)input = lambda: sys.stdin.readline().rstrip('\n')inf = float('inf')mod1 = 10**9+7mod2 = 998244353def ceil_div(x, y): return -(-x//y)#################################################Q = int(input())for _ in range(Q):d, k = map(int, input().split())if d == 0:if k == 1:print("Yes")print(0, 0)else:print("No")else:if k <= 4*d:print("Yes")if d%2 == 0:if k <= 4:print(d//2, d//2)elif k <= 4*d-4:x = (k-5)//8print(d//2+(1+x), d//2-(1+x))else:print(d, 0)else:if k <= d*4-4:x = ceil_div(k, 8)print(ceil_div(d, 2)+(x-1), d//2-(x-1))else:print(d, 0)else:print("No")