CCC2018有感

时间:2018年3月8日15:00-19:00  地点:清华大学东主楼实验室机房223

Problem 1

给两个字符串,忽略大小写比大小。输出那个字典序小的字符串(要转成全小写输出)。

Problem 2

给一简单表达式,形如 A ※ B = C。※可以是加、减、乘。也是字符串形式给出。会把A这个数字的某些位置挖成大写字母。大写字母的总种类数(即未知数数量)最多9个,并且只能取1-9可以取0-9,且不同未知数代表的数字不同。然后,问满足等式的解有多少组。

枚举0-9的全排列,共有10!种。由于数字最多是1e9,枚举每一种状态即可。复杂度刚好是 O(未知数数量!* 位数)。

接下来我们就进入了非水题部分。

Problem 3

对于一张图,含n个点。每个点有一个点权。对于任意一对 i < j,必有x条从 i 指向 j 的有向边,其中x的值为LCS1(val[i],val[j])。问,从节点1到节点n,有多少种走法?最终答案要mod一个数。就这个LCS1,我也不是很能懂。和队友的理解不同。存疑。

数据范围:n ≤ 1e5,val ≤ (1<<60)

考场上由于LCS1的理解,于是就只能保证了前20%的子数据。用dp去枚举路径,毕竟这个图也不成环,还是挺好的。其实事后听说LCS1只是表示二进制下的最长公共后缀所对应的十进制数,还是相当好求的。dp求路径简直不能再简单了!!!


Problem 4

给一个二分图,要求找到一个匹配(不一定完全匹配,只要收益最大就行。通俗来说,必须一夫一妻制),使得总收益最大。在二分图中,每个边都有两个权值a与b,把收益定义为:所有参与匹配的边,收益 = ∑a * ∑b。并且,从每一头公牛 i(就是左边那个集合中的点,二分图嘛,你们体会一下)发出的边只有两条,指向 x[i] 和 y[i] (x[i]是可以等于y[i]的)。并且从 i 发出的边,其两个权值均分别为a[i]与b[i]。

数据范围:n[公牛] ≤ 1000,然后a与b我忘了,反正long long是放得下的。

考场上暴力做了。枚举有效边集。(这次考试t2与t4都用了next_permutations)


Problem 5

有 n + 2 个座位,从0标号到 n + 1。其中第0个座位与第n + 1个座位不能被坐。与此同时我们还有n位同学。我们可以随意安排同学就坐的顺序,以及坐在哪里。每一个同学就坐时,如果他的左右两个座位都没有人,会有 a[i] 的收益;如果左右两个座位有一个有人,另一个空着,会有 b[i] 的收益;如果左右两个都有人,会有 c[i] 的收益。问可以取得的收益的最大值。

n ≤ 1e5,a、b、c放到long long一定没问题。

考场上写了一个小数据的状压dp(f[i][j]表示座椅状态为i(0与n+1不参与压缩,但是会特判的),人就坐的状态为j),仅对于 n ≤ 10的数据,但很可能被卡时。


正确的Solution以后会补上的。

<style scoped> .container { padding: 20rpx; padding-bottom: 120rpx; /* 为底部按钮留出空间 */ background-color: #f5f7fa; min-height: 100vh; } .header { background-color: #fff; border-radius: 16rpx; padding: 30rpx; margin-bottom: 20rpx; box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05); } .privacy-notice { margin-top: 20rpx; padding: 15rpx 20rpx; background-color: #f0f7ff; /* 浅蓝色背景突出显示 */ border-radius: 12rpx; font-size: 26rpx; color: #333; line-height: 1.6; white-space: normal; /* 确保自动换行 */ word-wrap: break-word; /* 长单词自动换行 */ text-align: justify; /* 两端对齐 */ border: 1rpx solid #d0e6ff; /* 浅蓝色边框 */ } .title { font-size: 36rpx; font-weight: bold; color: #333; margin-bottom: 20rpx; text-align: center; } .info { display: flex; justify-content: center; font-size: 28rpx; color: #666; } .info text { background-color: #f0f7ff; padding: 5rpx 15rpx; border-radius: 8rpx; margin: 0 10rpx; } .questions-section { background-color: #fff; border-radius: 16rpx; padding: 30rpx; margin-bottom: 20rpx; box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05); } .section-title { font-size: 32rpx; font-weight: bold; color: #333; padding-bottom: 20rpx; border-bottom: 1rpx solid #eee; margin-bottom: 30rpx; } .question-item { margin-bottom: 40rpx; padding-bottom: 30rpx; border-bottom: 1rpx dashed #eee; } .question-item:last-child { border-bottom: none; } .question-content { display: flex; margin-bottom: 20rpx; font-size: 28rpx; line-height: 1.6; } .question-number { font-weight: bold; min-width: 50rpx; color: #007aff; } .rating-container { display: flex; align-items: center; justify-content: space-between; } .stars { display: flex; } .star { font-size: 40rpx; color: #ccc; margin-right: 15rpx; transition: all 0.2s; cursor: pointer; } .star.filled { color: #ffb400; } .star.active { transform: scale(1.2); } .rating-text { font-size: 24rpx; color: #666; min-width: 180rpx; text-align: right; } .editor-container { border: 1rpx solid #e0e0e0; border-radius: 12rpx; overflow: hidden; margin-top: 20rpx; } .editor { min-height: 300rpx; padding: 20rpx; font-size: 28rpx; } .loading { display: flex; justify-content: center; padding: 40rpx 0; } .error-panel { background-color: #ffebee; border-radius: 12rpx; padding: 30rpx; display: flex; flex-direction: column; align-items: center; margin: 20rpx 0; } .error-panel text { color: #d32f2f; margin-bottom: 20rpx; text-align: center; } .bottom-buttons { position: fixed; bottom: 0; left: 0; right: 0; display: flex; padding: 20rpx; background-color: #fff; box-shadow: 0 -4rpx 12rpx rgba(0, 0, 0, 0.1); } .action-button { flex: 1; height: 90rpx; border-radius: 45rpx; display: flex; align-items: center; justify-content: center; font-size: 32rpx; font-weight: 500; margin: 0 15rpx; transition: all 0.3s; } .back-button { background-color: #f1f1f1; color: #666; } .back-button:active { background-color: #e0e0e0; } .submit-button { background: linear-gradient(to right, #2979ff, #1a68e8); color: #fff; } .submit-button:active { background: linear-gradient(to right, #1a68e8, #0a57d0); } .submit-button[disabled] { background: #a0c0ff; opacity: 0.7; } </style>
07-26
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值