ICode9

精准搜索请尝试: 精确搜索
  • # Educational Codeforces Round 135 (Rated for Div. 2) A-E2022-09-09 22:04:00

    Educational Codeforces Round 135 (Rated for Div. 2) 传送门 A 题意: 给定n个颜色的各自的数量,每次可以使用两个不同的颜料,问最后可能剩下哪种颜料,输出任意一个即可。 分析:直接输出个数最多的那个颜料即可 void solve(){ int n;cin>>n; vector<int>a(n+1); rep(i,1,n

  • Educational Codeforces Round 135 (Rated for Div. 2) A-D2022-09-09 02:00:09

    A. Colored Balls: Revisited 如果所有数加起来都没有最大值大,那最后剩下来的就是最大值 否则最后剩下来的可以是任何一个数 //#define int ll const int N = 2e5+10; int n,m; int a[N]; void solve() { cin>>n; int mx = 0,sum = 0,id; fo(i,1,n) { ci

  • Educational Codeforces Round 134 (Rated for Div. 2) D Maximum AND2022-09-02 14:30:39

    Maximum AND 贪心 从高位开始,尽可能地让 \(a\) 中该位为 \(0\) 的 和 \(b\) 中该位为 \(1\) 的配对在一起,换句话说,可以让 \(a\) 由小到大排序,\(b\) 由大到小排序 如果当前位最终是 \(1\),则继续该过程 如果当前位最终是 \(0\),则说明失配,考虑将这一位全部置为 \(1\) (排除这一位

  • Educational Codeforces Round 133 (Rated for Div. 2) ABD2022-08-30 04:30:08

    A. 2-3 Moves 题意:从0,每次 +2 -2 +3 - 3选一个,问多少次能到 n 由于对称性,先让 n = abs(n) 0只用0次,1只用1次 t = n / 3; 如果n % 3 == 1 ,说明t - 1 次 + 3 ,再来一次 +2 ,就可以了 如果 n % 3 == 0,说明t 次 +3 就可以了 如果n % 3 == 2,说明 t 次 +3 ,一次+2就可以额 void solve()

  • Educational Codeforces Round 134 (Rated for Div. 2)2022-08-29 19:04:53

    比赛链接: https://codeforces.com/contest/1721 D. Maximum AND 题意: 给定两个序列 \(a\) 和 \(b\),可以调整 \(b\) 中元素的位置,得到序列 \(c\),满足 \(c_i = a_i\) xor \(b_i\),问 \(c_1 \& c_2 \& ... \& c_n\) 最大是多少。 思路: 要让某一位上是 1,那么就要使得序列 \(c\) 中每一

  • Educational Codeforces Round 134 (Rated for Div. 2) A-C2022-08-28 13:03:00

    2A,C题wa2不知道为什么。B题少判一个条件:左上角 A : 题意有点不懂,到最后才知道是有多少种数,就输出这个种数-1即可 int n,m; void solve() { // cin>>n>>m; char s[4]; cin>>s[0]>>s[1]>>s[2]>>s[3]; set<int> q; fo(i,0,3) { q.insert(s[i]);

  • Educational Codeforces Round 134 (Rated for Div. 2)2022-08-28 11:01:20

    Educational Codeforces Round 134 (Rated for Div. 2) D. Maximum AND 题目大意 给出序列a,b,b可以任意排列,序列c有\(c_i=a_i\bigoplus b_i\)。c序列的价值为c1&c2&c33...&cn 分析 不难想到,从高到底考虑,每一个\(a_i\)与\(b_i\)对应二进制位。假设考虑的是其中bit位,则需要所有的\(a

  • Educational Codeforces Round 106 (Rated for Div. 2) | CF14992022-08-25 18:33:49

    E 一个暴力是显然的,\(f(i,j,k)\) 表示当前已经使用 \(a\) 的前 \(i\) 位,\(b\) 的前 \(j\) 位,最后一位是 \(a\) 还是 \(b\) 的。然后 \(O(n^2)\) 枚举起点跑下去即可。为啥这个是对的呢?考虑每次转移都是加 \(1/0\),显然之后在约束之下的转移本质不同。 第一眼我的想法是从如何对 \(2

  • Dashboard - Educational Codeforces Round 105 (Rated for Div. 2) - Codeforces2022-08-06 13:00:55

    Dashboard - Educational Codeforces Round 105 (Rated for Div. 2) - Codeforces 1.Problem - A - Codeforces 题意:给定字符串s,只存在ABC三种字母,相同字母只能变成相同的括号,问最后有没有可能形成合法括号。 思路:第一个括号和最后一个括号肯定是确定的,那就已经确定了两个字母,再分

  • Codeforces CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!) A-D 题解2022-08-01 22:34:56

    A. Two 0-1 Sequences  大致翻译: 两个长度为n和m的二进制序列a和b(题目保证n >= m) 两个操作: op1: 改变a(2) 为min(a(1), a(2)),并且移除a(1) op2: 改变a(2) 为max(a(1), a(2)),并且移除a(1) 每次操作后,原先的a(i)变成a(i + 1), 长度减少1,即前移。   a二进制序列能否通过这两个操作

  • CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!) (A——D)2022-08-01 17:02:44

    A. Two 0-1 Sequences 题意:从a数组的第一个和第二个元素中挑选一个元素留下来,另外一个丢掉。可以反复进行此操作。问最终a数组能否等于b数组。 思路: 注意,操作只能在第一个元素和第二个元素中进行。也就是说,一旦能删的删完了,a数组还不能等于b数组,那就是NO。 否则,从后往前看。如果b

  • CodeTon Round 2 (Div. 1 + Div. 2, Rated, Prizes!)2022-08-01 15:33:59

    \(\texttt{Rating Change:}\color{orange}{2213}\color{black}\to \color{orange}{2225}\) \(\Delta={\color{green}{\texttt{12}}}\qquad \texttt{rank:510}\) 最近质量最高的一场 Chinese Round 吧。 A 可以转化成每次将前面两个中选一个留下。这样也就是说只有 \(b\) 的第一位

  • Educational Codeforces Round 132 (Rated for Div. 2)(补题中)2022-07-24 18:02:21

     加粗:赛时AC  普通:赛后AC A. Three Doors 水题,但我一开始没看懂题意,就随便猜了个题意。反正就是拿着钥匙开一扇门,门后有别的钥匙,问你能不能全打开。 int main() { read(t); while(t--) { int x; read(x); memset(buc,0,sizeof(buc));

  • Educational Codeforces Round 132 (Rated for Div. 2)2022-07-24 17:02:36

    目录A. Three DoorsA 题意:A代码:B. Also Try MinecraftB 题意 及思路B 代码C. Recover an RBSC 题意以及思路C代码D. RorororobotD题题意及思路D代码:stip 题目链接 A. Three Doors A 题意: 总共三个箱子 开局提供一个钥匙,可开启编号相对应的一个箱子 每个箱子内会存放其他箱子的钥匙

  • Educational Codeforces Round 132 (Rated for Div. 2) A - E2022-07-23 00:31:47

    传送门 最近没进入状态,好久没更新博客了,有点开摆的感觉,不过集训期间肯定会认认真真打的 多校的题目是真的难顶 A - Three Doors 模拟一下 #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <string> #include <queue> #include <functiona

  • Educational Codeforces Round 132 (Rated for Div. 2) C2022-07-22 13:03:50

    https://codeforces.com/contest/1709/problem/C 题意 给你一个只包含{(,),?}的字符串。问有没有可能通过把?变成(或者),使得只存在唯一的改变方法能让字符串变为regular的 regular定义:A regular bracket sequence (or, shortly, an RBS) is a bracket sequence that can be transf

  • Educational Codeforces Round 132 (Rated for Div. 2)2022-07-22 11:05:45

    寅壬年六月廿三,公历2022年7月21日夜,与同机房大佬打CF,心态大崩,遂作此篇 T1 Three Doors 题目传送门 题目大意:有3个门,编号分别为1、2、3,其中两扇门后藏有钥匙。有3把钥匙,其中两把藏在门后,一把在手中。编号为i的门只能用编号为i的钥匙打开,藏在门后的钥匙只有在那扇门打开后才能使用。

  • Educational Codeforces Round 132 (Rated for Div. 2) A-C2022-07-22 10:07:28

    Educational Codeforces Round 132 (Rated for Div. 2) https://codeforces.com/contest/1709 这场ab很模拟(但我写的很慢),c居然比d难(策略性失误,悲) A. Three Doors 读题读了半天 题意 有三扇门,编号1-3,只有对应的钥匙才能开这扇门。 初始的时候手里有一把钥匙 现在有两扇门后面各藏

  • Educational Codeforces Round 132 (Rated for Div. 2)2022-07-22 01:31:54

    题目链接 A 水 B 题意 给一个数组 a[n], ai 为 i 处山的高度,可以在相邻两座山峰之间移动,如  ai-->a(i+1), 如果 ai>a(i+1),会受到伤害 ai - a(i+1),反之没有影响,给定两个点,问从一个点到另一个点受到的伤害最小为多少 思路 记录每两个点之间的伤害,再求前缀和即可,注意要从正反两边分

  • Educational Codeforces Round 130 (Rated for Div. 2)2022-07-17 11:31:32

    比赛链接: https://codeforces.com/contest/1697 C. awoo's Favorite Problem 题意: 有一个字符串 \(s\),每次可以选择一个字串 "ab" 将其改为 "ba" 或者选择 "bc" 将其改为 "cb"。再给定一个字符串 \(t\),问是否可以通过若干次操作让 \(s\) 变成 \(t\)。 思路: 首先看两个字符串中 'a

  • Educational Codeforces Round 129 (Rated for Div. 2)2022-07-13 10:32:22

    真,自闭场 C题已经忘记是什么了,记得一开始的做法不知道错哪了,最后改了个做法才过 D原本一直在想有什么数论上的性质和结论,一直局限于乘的那个数的选择,没有从因数的角度考虑,于是自闭 F最后看了下感觉可做,后来发现确实不难 D 其实本质是从搜索的角度出发,然后考虑状态的数量:只要发现每

  • Educational Codeforces Round 131 (Rated for Div. 2) A —— C2022-07-10 11:37:56

    A. Grass Field 解决代码: void solve() { int a, b, c, d; cin >> a >> b >>c >>d; int cnt = 0; cnt = a + b +c + d; if(cnt == 0) cout << 0 << endl; else if(cnt == 4) cout << 2 << endl; else cout << 1 &

  • Educational Codeforces Round 131 (Rated for Div. 2) A - D2022-07-10 01:31:47

    传送门 A - Grass Field 每次清除一行一列,最多也就清除 2 次,判断一下就好了 #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <string> #include <queue> #include <functional> #include <map> #include &

  • Educational Codeforces Round 131 (Rated for Div. 2) D题(区间贪心)2022-07-09 15:35:53

    题意:给定一个数组b,定义\(b_i=\lfloor \frac {i}{a_i}\rfloor\) ,还原这个a数组。 分析: 由于是下取整,所以对于每个\(a_i\) 我们都能得到\(a_i\)的范围 对于\(b_i \ne 0\) ,$ {i \over b_i + 1} \le a_i \lt {i \over b_i}$ 对于\(b_i = 0\) \(i + 1 \le a_i \lt n\) 所以问题可以转

  • Educational Codeforces Round 131 (Rated for Div. 2)2022-07-09 01:01:08

    题目链接 A. Grass Field 水   B. Permutation 题意 回想一下长度的排列n是一个数组,其中每个元素来自1至n恰好发生一次。对于一个固定的正整数d,让我们定义排列的值为长度p[n]中 pi⋅ d=pi+1 的数量.例如,如果d= 3和p = [ 5 , 2 , 6 , 7 , 1 , 3 , 4 ], 那么这种排列的值是2, 因为p

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有