結果
| 問題 |
No.5009 Draw A Convex Polygon
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-22 16:04:09 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 830 ms / 2,600 ms |
| コード長 | 1,384 bytes |
| コンパイル時間 | 676 ms |
| 実行使用メモリ | 30,824 KB |
| スコア | 1,000,000 |
| 平均クエリ数 | 987083.00 |
| 最終ジャッジ日時 | 2023-03-22 16:04:13 |
| 合計ジャッジ時間 | 3,262 ms |
|
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 |
ソースコード
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <map>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <algorithm>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;
bool rcmp(int a, int b) { return a>b; }
typedef long long LL;
class mypcmp {
public:
bool operator()(const int& a, const int& b) {
return a<b;
}
};
#define HH 10000
typedef struct { int x, y; } Point;
Point ps[1000000];
int xs[1000004];
int ys[1000004];
bool mycmp(const Point& a, const Point& b) {
//y/x >
LL v1=a.y; v1*=b.x;
LL v2=b.y; v2*=a.x;
return v1>v2;
}
int main() {
int n, i, x, y, k, d, h, j, m;
k=0; for (i=1; i<=800; i++) for (j=1; j<=800; j++) {
ps[k].x=i; ps[k].y=j; k++;
}
sort(ps, ps+k, mycmp);
x=-1000000000; y=0;
m=k; k=0;
for (i=0; i<m; i++) {
if (k>250000) break;
if (x>=0||y>1000000000) break;
if (i&&!mycmp(ps[i-1], ps[i])) continue;
xs[k]=x; ys[k]=y; k++;
x+=ps[i].x; y+=ps[i].y;
}
printf("%d\n", (k-1)*4);
for (i=1; i<k; i++) printf("%d %d\n", -xs[i], ys[i]);
for (i=k-1; i>0; i--) printf("%d %d\n", xs[i], ys[i]);
for (i=1; i<k; i++) printf("%d %d\n", xs[i], -ys[i]);
for (i=k-1; i>0; i--) printf("%d %d\n", -xs[i], -ys[i]);
return 0;
}