結果
| 問題 |
No.2493 K-th in L2 with L1
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-07 14:55:22 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 730 bytes |
| コンパイル時間 | 1,798 ms |
| コンパイル使用メモリ | 200,164 KB |
| 最終ジャッジ日時 | 2025-02-17 06:07:11 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int D,K;
cin>>D>>K;
vector A(0,array<int,2>());
if(D==0){
A.push_back({0,0});
}
for(int i=0;i<D;i++){
A.push_back({i,D-i});
A.push_back({D-i,-i});
A.push_back({-i,-D+i});
A.push_back({-D+i,i});
}
sort(A.begin(),A.end(),[](array<int,2>a,array<int,2>b){
return a[0]*a[0]+a[1]*a[1]<b[0]*b[0]+b[1]*b[1];
});
if(K>A.size()){
cout<<"No\n";
}else{
cout<<"Yes\n";
cout<<A[K-1][0]<<' '<<A[K-1][1]<<'\n';
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int test_case;
cin>>test_case;
while (test_case--){
solve();
}
}