結果
| 問題 |
No.2493 K-th in L2 with L1
|
| コンテスト | |
| ユーザー |
PAKACHU
|
| 提出日時 | 2023-10-06 22:13:27 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,204 bytes |
| コンパイル時間 | 3,016 ms |
| コンパイル使用メモリ | 164,480 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-26 16:26:45 |
| 合計ジャッジ時間 | 3,071 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
ソースコード
#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 < d; x++) {
int l = 0, r = 0;
for (int j = 0; j < d; j++) {
if (x * x + (d - x) * (d - x) >= j * j + (d - j) * (d - j)) {
r++;
if (x * x + (d - x) * (d - x) > j * j + (d - j) * (d - j)) {
l++;
}
}
}
l *= 4;
r *= 4;
if (l < k and r >= k) {
cout << "Yes" << endl;
cout << x << ' ' << d - x << endl;
return;
}
}
cout << "No" << endl;
}
int main()
{
int q;
cin >> q;
for (int i = 0; i < q; i++) {
solve();
}
}
PAKACHU