結果
| 問題 |
No.5009 Draw A Convex Polygon
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-02 01:23:41 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,016 ms / 2,600 ms |
| コード長 | 986 bytes |
| コンパイル時間 | 2,108 ms |
| 実行使用メモリ | 21,892 KB |
| スコア | 1,000,000 |
| 平均クエリ数 | 1000001.00 |
| 最終ジャッジ日時 | 2022-12-02 01:23:49 |
| 合計ジャッジ時間 | 4,819 ms |
|
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(){
vector<pair<int, int>> D;
int dx = 1;
int dy = 2;
while(D.size() * 4 < 1000000){
if(gcd(dx, dy) == 1){
D.push_back({dx, dy});
D.push_back({dy, dx});
}
dx++;
if(dx == dy){
dx = 1;
dy++;
}
}
sort(D.begin(), D.end(), [](pair<int, int> &l, pair<int, int> &r){
return l.first * r.second < r.first * l.second;
});
int x = -100000000;
int y = 0;
cout << 1000000 << '\n';
for(auto tmp:D){
x += tmp.first;
y -= tmp.second;
cout << x << " " << y << '\n';
}
for(auto tmp:D){
x += tmp.second;
y += tmp.first;
cout << x << " " << y << '\n';
}
for(auto tmp:D){
x -= tmp.first;
y += tmp.second;
cout << x << " " << y << '\n';
}
for(auto tmp:D){
x -= tmp.second;
y -= tmp.first;
cout << x << " " << y << '\n';
}
cout << flush;
}
int main(){
cin.tie(0)->sync_with_stdio(0);
cout << fixed << setprecision(12);
int t;
t = 1;
while(t--) solve();
}