結果
| 問題 |
No.2493 K-th in L2 with L1
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-06 23:24:13 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 994 bytes |
| コンパイル時間 | 3,567 ms |
| コンパイル使用メモリ | 264,308 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-26 17:06:29 |
| 合計ジャッジ時間 | 4,381 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e9;
const int MIN = -1*1e9;
const ll MAXLL = 1e18;
const ll MINLL = -1*1e18;
//const ll MOD = 998244353;
//const ll MOD = 1000000007;
int main()
{
int Q; cin >> Q;
for(int q = 0; q < Q; q++)
{
int A,B; cin >> A >> B;
vector<pair<int,string>> Ans;
for(int i = -A; i <= A; i++)
{
for(int j = -A; j <= A; j++)
{
if(abs(i)+abs(j)==A)
{
Ans.push_back({abs(i)*abs(i)+abs(j)*abs(j),(to_string(i)+" "+to_string(j))});
}
}
}
sort(Ans.begin(),Ans.end());
if(Ans.size() < B)
{
cout << "No" << endl;
}
else
{
cout << "Yes" << endl;
cout << Ans[B-1].second << endl;
}
}
return 0;
}