ICode9

精准搜索请尝试: 精确搜索
  • 【CF339D Xenia and Bit Operations】题解2022-04-29 17:34:35

    题目链接 题目 Xenia the beginner programmer has a sequence $ a $ , consisting of $ 2^{n} $ non-negative integers: $ a_{1},a_{2},...,a_{2^{n}} $ . Xenia is currently studying bit operations. To better understand how they work, Xenia decided to calculate some v

  • CF324E Xenia and Tree2022-02-27 09:33:50

    题目传送门 题意 有一颗树,初始\(1\)号点为红色,其余为蓝色,有两种操作:1.修改一个蓝点为红点。2.查询每个点最近红点的距离 题解 应该是较板题 最近根号写多了,首先想到的是: 每根号个询问重构一次,不超过根号就暴力枚举这个点和那根号个点的距离。 发现可能是对的,dp可以在\(O(n)\)复

  • [CF339D] Xenia and Bit Operation - 线段树2021-02-21 08:01:22

    [CF339D] Xenia and Bit Operation - 线段树 Description 给定一个序列,每次选择一个点修改权值,然后求出全序列的值(每相邻两个元素按位或得到长度减半的序列,在对每相邻两个元素按位异或得到长度再次减半的序列……更替的进行按位或/异或) Solution 不用想太多,直接线段树维护即可 #in

  • Xenia and Weights(dfs/dp)2021-02-14 23:01:49

    https://codeforces.com/problemset/problem/339/C 思路: 看着确实可以dfs一波,但是这个dfs的复杂度是多少呢...翻了一下网上的其他题解都找到说这个事的。 如果有老哥懂大致的复杂度可以评论区指点一下我 #include<iostream> #include<vector> #include<queue> #include<cstring

  • Codeforces 339D-Xenia and Bit Operations(线段树)2020-10-16 11:00:25

    传送门 还是比较明显的线段树的操作 #include<bits/stdc++.h> using namespace std; const int N=2e6+10; int a[N]; int tn,m,n; struct stree{ int id,num; }tree[N<<2]; int ls(int x) {return x<<1;} int rs(int x) {return x<<1|1;} void

  • D. Xenia and Colorful Gems(二分)2020-05-07 09:41:55

    题目传送门 题意: 给你na个红色糖,nb个绿色糖,nc个蓝色糖,每一块糖都有自己的一个权值,每种颜色拿一个,使得(x-y)2 + (x-z)2 +(y-z)2 尽可能小,x,y,z表示三块糖的权值。 思路: 我们知道选出的三块糖有 x<=y<=z (只看数值,不看颜色) ,那么我们枚举所有糖果,作为中间的这个,然后在另外两种

  • Codeforces 1337D Xenia and Colorful Gems2020-04-16 15:02:29

    题意 给你3个数组\(a, b\)和\(c\),最小化\((x-y)^2+(y-z)^2+(z-x)^2\),其中\(x \in a, y \in b, z \in c\)。 解题思路 这题其实第一眼就秒了,但是赛中突然不相信自己的直觉,然后就想复杂了。 就很气,本来30min前能过得题被我硬生生拖到了1h+。 解法简单的说,就是固定\(x\),然后分别在\(b

  • Xenia and Colorful Gems CodeForces - 1337D[binary search +data structures implementation+ math sorti2020-04-16 14:02:12

    Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. snoop dooogg~~~  Recently Xenia has bought nrnr red gems, ngng green gems and nbnb blue gems. Each of the gems has a

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

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

ICode9版权所有