結果

問題 No.5009 Draw A Convex Polygon
ユーザー lddlinanlddlinan
提出日時 2023-03-22 15:42:08
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 161 ms / 2,600 ms
コード長 1,048 bytes
コンパイル時間 574 ms
実行使用メモリ 22,608 KB
スコア 218,876
平均クエリ数 218877.00
最終ジャッジ日時 2023-03-22 15:42:10
合計ジャッジ時間 1,983 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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
int xs[1000004];
int ys[1000004];
int main() {
    int n, i, x, y, k, d, h;
    h=HH;
    x=-1000000000; y=0;  k=0; d=1;
    while(1) {
        if (k>250000) break;
        if (x>=0||y>1000000000) break;
        xs[k]=x; ys[k]=y; k++;
        x+=d; y+=h;
        if (h>d) h--;
        else d++;
    }
    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;
}
0