codeforces
文章平均质量分 62
acm
Asus.Blogs
这人懒散惯了,什么也没有写
展开
-
C. Where is the Pizza?【并查集】
C. Where is the Pizza? 题意:让你求一个排列数组ci在给定条件下有几种可能: 给你两个1-n的乱序排列a[],b[],再给你一个n个数的d[i]数组,if di==0: 可以选择ai or bi 填充ci,else: ci = di ,让你求c[]有多少可能 思路:其实一开始乱糟糟的没思路,但是模拟一下会发现几个数会组成一个环,而且每一个环的贡献值为2,假设有n个环,那么答案就是2^n; if ai==bi :贡献值为0 因为只有一种可能 if di != 0: 贡献值为0 因原创 2022-05-11 22:46:38 · 383 阅读 · 0 评论 -
D. Twist the Permutation
D. Twist the Permutation inputCopy 3 6 3 2 5 6 1 4 3 3 1 2 8 5 8 1 3 2 6 4 7 outputCopy 0 1 1 2 0 4 0 0 1 0 1 2 0 2 5 6 2 总感觉哪年省赛好像有类似的题,水一波题解 题意给你n个数的数组,问你能否通过循环数组还原到1-n ,这里的循环数组是从1号位到当前位进行循环,求每位需要循环操作多少次才能还原到1-n递增排列(输出总次数最少的一个答案) 思路: 我们可以从最后一项开始往前原创 2022-04-29 16:22:47 · 370 阅读 · 0 评论 -
H. Maximal AND【二进制+思维】
input 4 3 2 2 1 1 7 0 4 6 6 28 6 6 12 1 30 0 4 4 3 1 3 1 output 2 4 2147483646 1073741825 题意是给你 n, k 让你进行最多k次操作 使得整个数组 & 操作得到最大值 关于每次操作 你可以改变数组中某个数的某个二进制位变为 1 一开始一直用 | 操作进行模拟,但是后来一直控制不了次数,无奈瞟了眼题解~~~没能AK TAT 思路: 我们首先统计 二进制中 0-30 位每位有多少个 1,要想 &.原创 2022-04-26 09:39:39 · 403 阅读 · 0 评论 -
E Arranging The Sheep Codeforces Round #719 (Div. 3)
E. Arranging The Sheep time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are playing the game “Arranging The Sheep”. The goal of this game is to make the sheep line up. The level in the game is de原创 2021-09-07 22:04:29 · 97 阅读 · 0 评论 -
Three swimmers
A. Three swimmers time limit per test1 second memory limit per test512 megabytes inputstandard input outputstandard output Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool. It tak原创 2021-02-23 20:23:49 · 337 阅读 · 0 评论