結果

問題 No.2493 K-th in L2 with L1
ユーザー prin_kemkemprin_kemkem
提出日時 2023-10-06 21:49:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,262 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 81,572 KB
最終ジャッジ日時 2023-10-06 21:49:30
合計ジャッジ時間 2,557 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 178 ms
81,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque, Counter
import copy
from itertools import combinations, permutations, product, accumulate, groupby, chain
from heapq import heapify, heappop, heappush
import math
import bisect
from pprint import pprint
from random import randint
import sys
# sys.setrecursionlimit(700000)
input = lambda: sys.stdin.readline().rstrip('\n')
inf = float('inf')
mod1 = 10**9+7
mod2 = 998244353
def 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:
                x = ceil_div(k, 12)
                y = (k-1)%12+1
                if y <= 4:
                    print(d//2+2*(x-1), d//2-2*(x-1))
                else:
                    print(d//2+(2*(x-1)+1), d//2-(2*(x-1)+1))
            else:
                if k <= d*4-4:
                    x = ceil_div(k, 8)
                    print(ceil_div(d, 2)+(x-1), ceil_div(d, 2)-(x-1))
                else:
                    print(d, 0)
        else:
            print("No")
0