2019 南昌邀請賽(復現,簽到題題解)

2022-09-09 00:30:26 字數 2912 閱讀 8127

題解:利用字首和,求出所有區間值,然後操作排序,貪心求解即可

知識點:字首和 + 貪心

題解:map瞎搞,記錄字首的數量,暴力就可以過,對於我這種只會做簽到題的菜雞。不過這題更好的解法是字典樹。

注意:記得把所有的有關資料都開ll,以免相乘的時候出現精度丟失

題解:線段樹的更新,改點,異或的應用

ac**:

#include

#include

#include

#include

#include

#include

#include

using namespace std;

const

int n =

2e5+15;

#define ll long long

#define inf 0x3f3f3f3f

struct tree tree[n *2]

;int a[n]

;void

pushup

(int cur)

void

build

(int l,

int r,

int step)

build

(l, mid, step *2)

;build

(mid +

1, r, step *2+

1);pushup

(step);}

void

query

(int l,

int r,

int&x,

int&y,

int step)

int mid =

(tree[step]

.l + tree[step]

.r)/2;

if(r <= mid)

query

(l, r, x, y, step *2)

;else

if(l > mid)

query

(l, r, x, y, step *2+

1);else

else}}

void

update

(int tar,

int val,

int step)

int mid =

(l + r)/2

;if(tar <= mid)

update

(tar, val, step *2)

;else

update

(tar, val, step *2+

1);pushup

(step);}

intmain()

else

printf

("0\n");

}}}return0;

}

2019ICPC南昌邀請賽A題

當時隊友都在做其他的題,我就去看了一下。先交幾發最小生成樹wa下,然後就走了 打完比賽dalao們說是斯坦納樹板板。行吧 打完比賽太多了,直到現在才有時間,計蒜客也出復現賽了,就去學了一下 先說一下a題題意 先給n個點,點的名字還是英文的,還要記錄一下,然後給出m條邊。之後給出4行,每行兩個點的名字...

計蒜客 2019 南昌邀請賽 B題

題解 拉格朗日插值裸題 2019 icpc南昌區域賽 b題 includeusing namespace std typedef long long ll mod一定要是質數 const int mod 9999991 int pv 2000 前幾項,前面無效值用0佔位 int st 1,ed 使用...

2018南昌邀請賽網路賽d題

剛開始看到此提時也沒想到dp 但是仔細一思考可以發現確實是 我們只要單獨處理第一位數 剩下的符號和數字看成乙個物品 進行類似揹包的dp即可 首先預處理所有火柴和符號 根據輸入的總火柴進行一次dp即可 include include include includeusing namespace std...