日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

第六次周赛

發布時間:2023/12/19 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 第六次周赛 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

失望……

B題其實很簡單,完全有能力出,我和luyi陷在我一個錯誤的樹DP模型中……

其實就是幾個簡單的組合數,誰可以都會的問題。

PROBLEM B 1 #include <iostream>
2 #include <algorithm>
3 #include <cstring>
4 #include <cstdio>
5 #include <string>
6 #include <numeric>
7 ?using namespace std;
8 const int N = 1011;
9 const long long MOD = 1000003;
10 const int M = 1011;
11 struct node
12 {
13 int v, s;
14 node *left, *right;
15 }pool[N], *root, *pp;
16
17 int a[N], b[N];
18 long long dp[N][M], c[N][N];
19 int n, m;
20 void preprocess()
21 {
22 for(int i = 1;i < N;i++)
23 {
24 c[i][0] = 1;
25 c[i][i] = 1;
26 for(int j = 1;j < i;j++)
27 c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % MOD;
28 }
29 }
30
31 node *newNode(int v)
32 {
33 pp->left = pp->right = NULL;
34 pp->v = v;
35 pp->s = 1;
36 return pp++;
37 }
38
39 void insert(node* &root, int v)
40 {
41 if(root == NULL)
42 {
43 root = newNode(v);
44 return;
45 }
46 root->s++;
47 if(v > root->v)
48 insert(root->right, v);
49 else
50 insert(root->left, v);
51 }
52
53 long long dfs(node* root)
54 {
55 long long ans = 1;
56 if(!root)
57 return ans;
58 if(root->left && root->right)
59 ans *= c[root->left->s + root->right->s][root->left->s];
60 ans = ans * dfs(root->left) % MOD;
61 ans = ans * dfs(root->right) % MOD;
62 return ans;
63 }
64
65 int main()
66 {
67 int cases;
68 preprocess();
69 scanf("%d", &cases);
70 while(cases--)
71 {
72 scanf("%d %d", &n, &m);
73 root = NULL;
74 pp = pool;
75 for(int i = 0;i < n;i++)
76 {
77 scanf("%d", &a[i]);
78 insert(root, a[i]);
79 }
80 printf("%lld\n", (c[m][n] * dfs(root)) % MOD);
81 }
82 return 0;
83 }

小猴一樣是半調子……喊了半年了博弈依然沒有學,他的數學底子是很好的,但是已經揮霍太多了……

我們現在攻關強題的能力完全沒有,唯一能保證的就是簡單題的1A……

接下來會越來越艱難。

新成立的IF隊的實力很強,在少一人的情況下一樣可以完虐我們。epic更不用說了,是今天的一隊,實力更在我們之上。

ACMaster經過了長時間的磨合,實力也比我們強,而且相比于我們他們的個人實力都比較綜合,尤其是ALEX,discover是數學強人,小猴這樣半調子下去根本沒法比。

新成立的TMP在少一人的情況下,依然和我們是平手……

我真的希望明年能有一個金牌……但是現實是殘酷的,以隊伍現在的實力真的是沒法取得什么樣的成績。

不知近年是否有我們出去比賽的機會了,我希望能多見識一下場面,但是復旦已經決定由ACMaster和epic出戰了機會估計是沒有了吧

接下來好好備戰吧,省賽四省賽要取得好的成績呀!

下周一定要把按位DP搞定,不能再拖了!

轉載于:https://www.cnblogs.com/ronaflx/archive/2011/04/10/2011774.html

總結

以上是生活随笔為你收集整理的第六次周赛的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。