Difficulty Control
题意
中文题目不说了。
题解
dfs+剪枝
-
剩下的加不到最优值剪掉
-
已经加过了最优值剪掉
我在大二的时候TLE了20次的题目终于在队友的指导之下完成了。
ac代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include
using
#define
#define
#define
#define
typedef
typedef
const
//head
ll n,m;
const
ll num[maxn];
vector
ll ans = INT_MAX;
int
int
void
if
ans = abs
memcpy
}
ll tt = 0
if
rep(i,x,n) tt += num[ve[i]];
if
if
return
}
temp[ve[x]] = 1
dfs(x+1
temp[ve[x]] = 0
dfs(x+1
}
int
#ifdef
freopen("1.in"
#endif
while
ve.clear();
memset
memset
rep(i,0
ll x; char
ve.push_back(ch-'A'
num[ch-'A'
}
sort(ve.begin(),ve.end());
ans = INT_MAX;
dfs(0
vector
rep(i,0
int
printf
rep(i,0
printf
}
}
return
}
[hdoj2260]Difficulty control(dfs)
https://www.cheasim.com/dfs/2019/03/06/hdoj2260-Difficulty-control-dfs.html
作者 CheaSim
发布于 2019-03-06
更新于 2019-03-06
许可协议
#dfs