校內模擬 Ball(計算幾何)(bitset)

2021-09-25 17:26:09 字數 1511 閱讀 5256

傳送門,是肯定沒有的。

正解是乙個o(n

2log⁡n

)o(n^2\log n)

o(n2

logn

)單調佇列維護π

3\frac

3π​極角序掃瞄線的大常數做法。

很顯然答案一定由某個三角形得到。

對所有o(n

2)

o(n^2)

o(n2

)條邊進行基數排序。按照從大到小插入,同時維護是否形成任何三角形。

**:

#include

#define ll long long

#define re register

#define gc get_char

#define cs const

namespace io

template

<

typename t>

inline t get()

inline

intgetint()

}using

namespace io;

using std::cerr;

using std::cout;

struct point

point

(cs int _x,cs int

&_y):x

(_x),y

(_y)

inline

friend point operator

+(cs point &a,cs point &b)

inline

friend point operator

-(cs point &a,cs point &b)

inline

friend

intoperator

*(cs point &a,cs point &b)

inline

intnorm

()cs};

cs int n=

4e3+7;

int n;

point p[n]

;inline

intdist

(cs point &a,cs point &b)

inline

intval

(int id)

cs int size=n*n>>1;

int id[size]

,cnt;

inline

void

radix_sort

(int

*cs a,

int n)

std::bitset f1[n]

,f2[n]

;signed

main()

f2[u]

|=f1[v]

;f2[v]

|=f1[u]

; f1[u]

[v]=

1;f1[v]

[u]=1;

}return0;

}

計算機等級考試一級B考試模擬試題一

1 計算機的特點是處理速度快 計算精度高 儲存容量大 可靠性高 工作全自動以及 a 造價低廉 b 便於大規模生產 c 適用範圍廣 通用性強 d 體積小巧 答案 c 解析 計算機的主要特點就是處理速度快 計算精度高 儲存容量大 可靠性高 工作全自動以及適用範圍廣 通用性強。2 1983年,我國第一台億...

2013計算機等級考試一級B模擬試題及答案6

1 網域名稱mh.bit.edu.cn中主機名是 a mh b edu c cn d bit 2 下列各組軟體中,全部屬於應用軟體的是 a 程式語言處理程式 作業系統 資料庫管理系統 b 文字處理程式 編輯程式 unix作業系統 c 財務處理軟體 金融軟體 wps office 2003 d wor...

2011計算機等級考試一級B模擬試題及答案 二

1 計算機按其效能可以分為5大類,即巨型機 大型機 小型機 微型機和 a 工作站 b 超小型機 c 網路機 d 以上都不是 答案 a 解析 人們可以按照不同的角度對計算機進行分類,按照計算機的效能分類是最常用的方法,通常可以分為巨型機 大型機 小型機 微型機和工作站。2 第3代電子計算機使用的電子元...