結果

問題 No.2493 K-th in L2 with L1
ユーザー cho435cho435
提出日時 2023-10-06 21:36:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 4,322 ms
コンパイル使用メモリ 258,880 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-10-06 21:36:24
合計ジャッジ時間 4,829 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

void solve(){
	int d,k;
	cin>>d>>k;
	if(d==0){
		if(k==1){
			cout<<"Yes\n";
			cout<<"0 0\n";
		}else{
			cout<<"No\n";
		}
		return;
	}
	if(d*4<k){
		cout<<"No\n";
		return;
	}
	cout<<"Yes\n";
	int mx=d*4;
	mx-=4;
	if(mx<k){
		cout<<0<<" "<<d<<"\n";
		return;
	}
	int ct=0;
	while(mx>=k){
		mx-=8;
		ct++;
	}
	cout<<ct<<" "<<d-ct<<"\n";
}

int main(){
	int t;
	cin>>t;
	rep(i,t) solve();
}
0