結果

問題 No.2493 K-th in L2 with L1
ユーザー 蜜蜂蜜蜂
提出日時 2023-10-06 22:14:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,495 bytes
コンパイル時間 3,996 ms
コンパイル使用メモリ 237,952 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-10-06 22:14:28
合計ジャッジ時間 4,853 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
4,376 KB
testcase_02 AC 3 ms
4,384 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:65:10: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   65 |     auto [ds,x,y]=v[k-1];
      |          ^

ソースコード

diff #

// g++-13 4.cpp -std=c++17 -O2 -I .
#include <bits/stdc++.h>
using namespace std;

#include <atcoder/all>
using namespace atcoder;

using ll = long long;
using ld = long double;
 
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vst = vector<string>;
using vvst = vector<vst>;
 
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define pq_big(T) priority_queue<T,vector<T>,less<T>>
#define pq_small(T) priority_queue<T,vector<T>,greater<T>>
#define all(a) a.begin(),a.end()
#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)
#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)
#define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int q;cin>>q;
  while(q--){
    int d,k;cin>>d>>k;
    if(d==0){
      if(k==0){
        cout<<"Yes"<<endl;
        cout<<"0 0"<<endl;
        continue;
      }
      else{
        cout<<"No"<<endl;
        continue;
      }
    }
    if(4*d<k){
      cout<<"No"<<endl;
      continue;
    }
    vector<tuple<ll,int,int>> v;
    rep(x,0,d+1){
      int y=d-x;
      int ds=x*x+y*y;
      v.emplace_back(ds,x,y);
      if(x!=0&&y!=0)v.emplace_back(ds,-x,-y);
      if(x!=0)v.emplace_back(ds,-x,y);
      if(y!=0)v.emplace_back(ds,x,-y);
    }
    sort(all(v));

    cout<<"Yes"<<endl;
    auto [ds,x,y]=v[k-1];
    cout<<x<<" "<<y<<endl;
  }
}
0