結果
| 問題 | No.2493 K-th in L2 with L1 |
| コンテスト | |
| ユーザー |
Haa
|
| 提出日時 | 2023-10-06 21:25:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 962 bytes |
| コンパイル時間 | 1,869 ms |
| コンパイル使用メモリ | 176,720 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-26 15:42:08 |
| 合計ジャッジ時間 | 2,422 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
template<typename T> bool chmax(T& x, const T& y){return (x<y)?(x=y,true):false;};
template<typename T> bool chmin(T& x, const T& y){return (x>y)?(x=y,true):false;};
constexpr ll MOD=998244353;
constexpr ll INF=2e18;
int main(){
int q; cin >> q;
int d, k;
REP(_,q){
cin >> d >> k;
vector<pair<int,P>> p;
for(int x=-d;x<=d;x++)for(int y=-d;y<=d;y++){
if(abs(x)+abs(y)==d){
p.push_back({x*x+y*y,{x,y}});
}
}
sort(ALL(p));
int n=p.size();
if(n<k)
cout << "No" << endl;
else{
cout << "Yes" << endl;
cout << p[k-1].second.first << " " << p[k-1].second.second << endl;
}
}
return 0;
}
Haa