結果
| 問題 |
No.2493 K-th in L2 with L1
|
| コンテスト | |
| ユーザー |
bortik
|
| 提出日時 | 2023-10-06 21:37:30 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 925 bytes |
| コンパイル時間 | 1,775 ms |
| コンパイル使用メモリ | 202,304 KB |
| 最終ジャッジ日時 | 2025-02-17 04:54:59 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 3 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, n, a) for (int i = (int)(n); i >= (int)(a); i--)
void solve(){
int d,k; cin >> d >> k;
vector<pair<int, pair<int,int>>> dist;
rep(i,0,d){
int x = i;
int y = d-i;
dist.push_back(make_pair(x*x+y*y, make_pair(x,y)));
dist.push_back(make_pair(x*x+y*y, make_pair(-x,y)));
dist.push_back(make_pair(x*x+y*y, make_pair(x,-y)));
dist.push_back(make_pair(x*x+y*y, make_pair(-x,-y)));
}
sort(dist.begin(), dist.end());
if(dist.size() < k){
cout << "No";
} else{
cout << "Yes\n" << dist[k-1].second.first << " " << dist[k-1].second.second;
}
cout << '\n';
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
rep(i,0,t) solve();
return 0;
}
bortik