結果
| 問題 |
No.5009 Draw A Convex Polygon
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-02 17:46:09 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,689 ms / 2,600 ms |
| コード長 | 1,205 bytes |
| コンパイル時間 | 2,665 ms |
| 実行使用メモリ | 21,952 KB |
| スコア | 1,000,000 |
| 平均クエリ数 | 967232.00 |
| 最終ジャッジ日時 | 2022-12-02 17:46:17 |
| 合計ジャッジ時間 | 6,417 ms |
|
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}
bool compare(pair<int,int>&p1,pair<int,int>&p2){
return p1.second*p2.first<p1.first*p2.second;
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n=1e6;
vector<pair<int,int>>vp;
for(int i=1;i<=800;i++)for(int j=1;j<=800;j++){
if(gcd(i,j)==1)vp.push_back(make_pair(i,j));
}
sort(all(vp),compare);
cout<<n<<endl;
int x=0,y=-1e9;
rep(i,n/4){
cout<<x<<" "<<y<<endl;
x+=vp[i].first;
y+=vp[i].second;
}
rrep(i,n/4){
cout<<x<<" "<<y<<endl;
x-=vp[i].first;
y+=vp[i].second;
}
rep(i,n/4){
cout<<x<<" "<<y<<endl;
x-=vp[i].first;
y-=vp[i].second;
}
rrep(i,n/4){
cout<<x<<" "<<y<<endl;
x+=vp[i].first;
y-=vp[i].second;
}
}