結果
| 問題 |
No.2493 K-th in L2 with L1
|
| コンテスト | |
| ユーザー |
maeshun
|
| 提出日時 | 2023-10-06 21:29:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 1,171 bytes |
| コンパイル時間 | 4,316 ms |
| コンパイル使用メモリ | 239,836 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-26 15:44:54 |
| 合計ジャッジ時間 | 4,782 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:42:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
42 | auto [d, x, y] = vs[k-1];
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for(int i=0;i<(n);++i)
#define rep1(i, n) for(int i=1;i<=(n);i++)
#define ll long long
using mint = modint998244353;
using P = pair<ll,ll>;
using lb = long double;
using T = tuple<ll, ll, ll>;
#ifdef LOCAL
# include <debug_print.hpp>
# define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
# define dbg(...) (static_cast<void>(0))
#endif
int main()
{
int q;
cin >> q;
rep(qi,q){
int d, k;
cin >> d >> k;
vector<T> vs;
for(int x=0;x<=d;x++){
int y = d - abs(x);
int r = x*x + y*y;
vs.emplace_back(r, x, y);
vs.emplace_back(r, -x, y);
vs.emplace_back(r, x, -y);
vs.emplace_back(r, -x, -y);
}
sort(vs.begin(),vs.end());
vs.erase(unique(vs.begin(),vs.end()),vs.end());
if(vs.size()<k){
cout << "No" << endl;
}
else{
cout << "Yes" << endl;
auto [d, x, y] = vs[k-1];
cout << x << " " << y << endl;
}
}
return 0;
}
maeshun