結果
問題 |
No.2493 K-th in L2 with L1
|
ユーザー |
![]() |
提出日時 | 2023-11-24 20:47:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,122 bytes |
コンパイル時間 | 1,986 ms |
コンパイル使用メモリ | 198,980 KB |
最終ジャッジ日時 | 2025-02-17 23:37:49 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); int q; cin >> q; for (; q--;) { int d, k; cin >> d >> k; if (d == 0) { if (k == 1) { cout << "Yes\n"; cout << "0 0\n"; } else { cout << "No\n"; } } if (k > 4 * d) { cout << "No\n"; continue; } vector<pair<int, int>> points; for (int x = -d; x <= d; x++) { points.push_back({x, d - abs(x)}); if (x != d && x != -d) { points.push_back({x, abs(x) - d}); } } sort(points.begin(), points.end(), [](const pair<int, int> &a, const pair<int, int> &b) { return a.first * a.first + a.second * a.second < b.first * b.first + b.second * b.second; }); cout << "Yes\n"; cout << points[k - 1].first << " " << points[k - 1].second << "\n"; } }