結果
| 問題 |
No.2493 K-th in L2 with L1
|
| コンテスト | |
| ユーザー |
PAKACHU
|
| 提出日時 | 2023-10-06 22:03:02 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,251 bytes |
| コンパイル時間 | 2,215 ms |
| コンパイル使用メモリ | 164,100 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-26 16:08:18 |
| 合計ジャッジ時間 | 3,310 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 1 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }, dy[8] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const long long mod = 998244353;
const ll inf = 1LL << 60;
const int INF = 5e8;
void solve()
{
int d, k;
cin >> d >> k;
vector<int> v;
if (d == 0) {
if (k == 1) {
cout << "Yes" << endl;
cout << 0 << ' ' << 0 << endl;
} else {
cout << "No" << endl;
}
return;
}
for (int x = 0; x <= 2 * d; x++) {
for (int y = 0; y <= 2 * d; y++) {
int l = 0, r = 0;
for (int j = 0; j < d; j++) {
if (x * x + y * y >= j * j + (d - j) * (d - j))
r++;
else if (x * x + y * y > j * j + (d - j) * (d - j))
l++;
}
l *= 4;
r *= 4;
if (l < k and r >= k) {
cout << "Yes" << endl;
cout << x << ' ' << y << endl;
return;
}
}
}
cout << "No" << endl;
}
int main()
{
int q;
cin >> q;
for (int i = 0; i < q; i++) {
solve();
}
}
PAKACHU