結果
問題 | No.2493 K-th in L2 with L1 |
ユーザー |
![]() |
提出日時 | 2023-10-06 21:41:08 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 1,063 bytes |
コンパイル時間 | 3,175 ms |
コンパイル使用メモリ | 267,040 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-26 15:53:44 |
合計ジャッジ時間 | 3,685 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 |
ソースコード
#include <bits/stdc++.h>namespace nono {void solve() {constexpr int D = 100;std::vector good_points(D + 1, std::vector<std::tuple<int, int, int>>());for (int i = -D; i <= D; i++) {for (int j = -D; j <= D; j++) {int d = std::abs(i) + std::abs(j);if (d <= D) {good_points[d].emplace_back(i * i + j * j, i, j);}}}for (int i = 0; i <= D; i++) {std::ranges::sort(good_points[i]);}int q;std::cin >> q;while (q--) {int d, k;std::cin >> d >> k;if ((int)good_points[d].size() >= k) {std::cout << "Yes" << std::endl;std::cout << std::get<1>(good_points[d][k - 1]) << ' ' << std::get<2>(good_points[d][k - 1]) << std::endl;} else {std::cout << "No" << std::endl;}}}} // namespace nonoint main() {std::cin.tie(0)->sync_with_stdio(false);std::cout << std::fixed << std::setprecision(15);int t = 1;while (t--) nono::solve();}