結果
問題 | No.2493 K-th in L2 with L1 |
ユーザー |
|
提出日時 | 2024-02-03 14:42:01 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 747 bytes |
コンパイル時間 | 24,194 ms |
コンパイル使用メモリ | 357,328 KB |
最終ジャッジ日時 | 2025-02-19 01:09:56 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 |
ソースコード
#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include<bits/stdc++.h> #include<atcoder/all> using namespace std; using namespace atcoder; using ll=long long; using ld=long double; using T=tuple<ld,ll,ll>; void IO(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main(){ IO(); ll q; cin>>q; while(q--){ ll d,k; cin>>d>>k; vector<T> v; for(ll i=-d;i<=d;i++){ for(ll j=-d;j<=d;j++){ if(abs(i)+abs(j)==d){ v.push_back(T(sqrt(i*i+j*j),i,j)); } } } sort(v.begin(),v.end()); if(v.size()<k){ cout<<"No"<<endl; }else{ cout<<"Yes"<<endl; cout<<get<1>(v[k-1])<<" "<<get<2>(v[k-1])<<endl; } } }