結果
| 問題 |
No.2493 K-th in L2 with L1
|
| ユーザー |
|
| 提出日時 | 2023-10-12 18:05:27 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,061 bytes |
| コンパイル時間 | 1,597 ms |
| コンパイル使用メモリ | 132,700 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 16:34:59 |
| 合計ジャッジ時間 | 2,606 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 1 WA * 3 |
ソースコード
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
using i64 = long long;
using P = pair<int, int>;
#define yn(pope) (pope ? "Yes" : "No")
#define rep(i, n, m) for (int i = (n); i < (m); i++)
#define rrep(i, n, m) for (int i = (n); i > m; i--)
#define IINF (1 << 30)
#define INF (1ll << 60)
#define all(v) v.begin(), v.end()
int main() {
int Q;
cin >> Q;
auto f = [](P a, P b) -> bool {
int a_ = a.first * a.first + a.second * a.second;
int b_ = b.first * b.first + b.second * b.second;
return a_ < b_;
};
while (Q--) {
int d, k;
cin >> d >> k;
vector<P> G;
rep(i, 0, d + 1) {
G.push_back({i, d - i});
G.push_back({-i, d - i});
G.push_back({i, i - d});
G.push_back({-i, i - d});
}
sort(all(G));
G.erase(unique(all(G)), G.end());
sort(all(G), f);
if (G.size() < k) {
cout << "No" << endl;
} else {
cout << "Yes" << endl;
cout << G[k].first << " " << G[k].second << endl;
}
}
return 0;
}