結果

問題 No.2493 K-th in L2 with L1
ユーザー PAKACHUPAKACHU
提出日時 2023-10-06 22:03:02
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,251 bytes
コンパイル時間 2,305 ms
コンパイル使用メモリ 135,144 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-10-06 22:03:07
合計ジャッジ時間 3,430 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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();
    }
}
0