結果

問題 No.5009 Draw A Convex Polygon
ユーザー umezoumezo
提出日時 2022-12-02 01:04:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 797 ms / 2,600 ms
コード長 1,333 bytes
コンパイル時間 2,069 ms
実行使用メモリ 37,396 KB
スコア 1,000,000
平均クエリ数 976001.00
最終ジャッジ日時 2022-12-02 01:04:58
合計ジャッジ時間 4,526 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 797 ms
37,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  vector<pair<int,int>> A={{1,1},{1,2}};
  rep(_,17){
    int a=A.size();
    vector<pair<int,int>> B;
    rep(i,a-1){
      B.push_back(A[i]);
      B.push_back({A[i].first+A[i+1].first,A[i].second+A[i+1].second});
    }
    B.push_back(A[a-1]);
    swap(A,B);
  }
  
  int a=A.size();
  int N=-1;
  rep(i,a) N+=A[i].first+A[i].second;
  int x=N,y=0;
  
  vector<pair<int,int>> C;
  for(int i=a-1;i>0;i--){
    C.push_back({x,y});
    x-=A[i].first;
    y+=A[i].second;
  }
  C.push_back({x,y});
  x--;
  y++;
  for(int i=1;i<a;i++){
    C.push_back({x,y});
    x-=A[i].second;
    y+=A[i].first;
  }
  
  int c=C.size();
  vector<pair<int,int>> ANS;
  rep(i,c) ANS.push_back(C[i]);
  rep(i,c){
    int nx=C[i].first,ny=C[i].second;
    ANS.push_back({-ny,nx});
  }
  rep(i,c){
    int nx=C[i].first,ny=C[i].second;
    ANS.push_back({-nx,-ny});
  }
  rep(i,c){
    int nx=C[i].first,ny=C[i].second;
    ANS.push_back({ny,-nx});
  }
  cout<<1000000<<'\n';
  rep(i,1000000){
    if(i<999999) cout<<ANS[i].first<<" "<<ANS[i].second<<'\n';
    else cout<<ANS[i].first<<" "<<ANS[i].second<<endl;
  }
  
  return 0;
}
0