2018 計蒜之道 初賽 第一場

2022-03-31 23:20:45 字數 1378 閱讀 4537

題解:典型的二分

1

#pragma warning(disable:4996)

2 #include3 #include4 #include

5 #include6 #include7 #include8 #include9

#define ll long long

10using

namespace

std;

1112

const

int maxn = 20005;13

14ll s;

15int

n, p;

16int

a[maxn];

1718

bool check(int

mid)

2526

intsolve()

33return

l;34}35

36int

main()

3744

return0;

45 }

題解:資料比較小的時候建圖,跑dfs統計總的汙染值即可。

感受:題意不明!!!!!書替換後不會對以前的結果造成影響。所以~~要n何用。

1

#pragma warning(disable:4996)

2 #include3 #include

4 #include5 #include6 #include7 #include8

#define ll long long

9using

namespace

std;

1011

const ll inf = 1000000000000000;12

13int

n, m;

14int p[30], pos[30

];15

16 vector book[30

];17

18bool use[30

];19

20 ll dp[30

];21

22void dfs(int

u) 31}32

}3334int

main()

3551

else56}

5758 ll ans =inf;

59for (int i = 1; i <= k; i++)

65 cout << ans <6667

for (int i = 1; i <= k; i++) book[i].clear();68}

69return0;

70 }

2017 計蒜之道 初賽 第一場

阿里的新遊戲 阿里九遊開放平台近日上架了一款新的益智類遊戲 成三棋。成三棋是我國非常古老的乙個雙人棋類遊戲,其棋盤如下圖所示 如果一條線段上的三個交叉點都被同一玩家的棋子佔據的話,則稱這條線段被該玩家成三。現在,小紅和小明兩人在遊戲平台上下棋,其中小紅的棋子是黑色的。請你幫小紅計算他成三的線段數。樣...

2017計蒜之道 初賽 第一場

16種情況手動暴力即可 include define nmax 7 using namespace std int mp nmax nmax int n,m int cnt 0 void ge void check if mp 0 0 1 mp 3 0 1 mp 6 0 1 if mp 0 6 1 ...

2016 計蒜之道 初賽 第一場 題解 待補

對於金鑰 s1.sn,我們需要首先計算其對應的 陣列。對於任意的 i 2 i n i ma x 也就是最長的字首等於字尾的長度。n i 2 i 值越小,易破解程度越高。現在已知金鑰的 s1 sn 中每個小寫字母的字元個數,小明想知道易破解程度最高是多少?官方題解 如果只有一種字元,很好得出答案。超過...