結果

問題 No.5009 Draw A Convex Polygon
ユーザー ransewhaleransewhale
提出日時 2022-12-02 01:11:01
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,910 ms / 2,600 ms
コード長 1,460 bytes
コンパイル時間 889 ms
実行使用メモリ 25,736 KB
スコア 1,000,000
平均クエリ数 1000001.00
最終ジャッジ日時 2022-12-02 01:11:08
合計ジャッジ時間 5,411 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
純コード判定しない問題か言語
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

#pragma GCC optimize("O2")

using ll = long long int;
using P = std::pair<int, int>;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

std::vector<P> vec,v;

bool comp(P a, P b){
	return (a.first * b.second < b.first * a.second);
}

bool eq(P a, P b){
	return (a.first * b.second == b.first * a.second);
}

int main(void){
	int n=1000000,i,j,x=0,y=0;
	std::cout << n << std::endl;
	for(i=1; i<=666; ++i){
		for(j=1; j<=666; ++j){
			vec.push_back(P(i,j));
		}
	}
	vec.push_back(P(1,0)); n /= 4;
	std::sort(vec.begin(),vec.end(),comp);
	for(i=0; i<vec.l_ength(); ++i){
		if(eq(vec[i],vec[i+1])){
			continue;
		}
		x += vec[i].first;
		v.push_back(vec[i]);
		if(v.l_ength() == n){
			break;
		}
	}
	for(i=0; i<n; ++i){
		std::cout << x << " " << y << std::endl;
		x -= v[i].first; y += v[i].second;
	}
	for(i=n-1; i>=0; --i){
		std::cout << x << " " << y << std::endl;
		x -= v[i].first; y -= v[i].second;
	}
	for(i=0; i<n; ++i){
		std::cout << x << " " << y << std::endl;
		x += v[i].first; y -= v[i].second;
	}
	for(i=n-1; i>=0; --i){
		std::cout << x << " " << y << std::endl;
		x += v[i].first; y += v[i].second;
	}
	return 0;
}
0