ICode9

精准搜索请尝试: 精确搜索
  • CF767B 【The Queue】 题解--zhengjun2022-06-11 14:00:08

    solution 一道贪心题。 如果有两个人分别在\(x\)和\(y\)来(\(x<y\)且这两个人来的时刻的中间没有其他人) 那么\(Vasya\)从\(x+m\)到\(y-1\)这段时间来都一样,那么我们就枚举每一个人,然后看看如果\(Vasya\)在这个人之前插进去最少要等多长时间,更新答案就可以了 #include<cstdio> #incl

  • cf1076 E. Vasya and a Tree(树上差分)2021-12-20 21:33:11

    题意: n个节点的树,m次询问,每次把v的子树中与v的距离不超过d的节点都加上x。输出最终所有点的值。 n,m <= 3e5,d,x <= 1e9 思路: 每次处理节点u的所有询问,对每个询问,修改差分数组的区间 \([h,h+d]\) 的两个端点。每次把差分前缀和传递给儿子。 每差分完一棵子树都要还原差分数组。 应

  • Vasya的书【D1-00007】2021-12-18 16:01:18

    D1-00007 Vasya的书 时间限制:1000 MS 空间限制:128 MB 题目描述 Vasya有n本书,编号为11~n,放在一个栈中(栈指数据结构中的栈),栈顶的书的编号是a​1​​,其次是a​2​​,以此类推。 Vasya通过n次操作将所有书放到她的书包里,对于第i步,她想把编号为b​i​​的书放入书包,这时: 如果

  • CodeForces-1076E Vasya and a Tree2021-07-20 12:03:16

    CodeForces - 1076E Problem Description: Vasya has a tree consisting of n vertices with root in vertex 1. At first all vertices has 0 written on it. Let d(i,j) be the distance between vertices i and j, i.e. number of edges in the shortest path from i to

  • Vasya and Good Sequences CodeForces - 1030E2021-07-09 08:31:45

    原题链接 考察:思维 思路:   从样例一很容易想到二进制1的个数一定要为偶数个,但是这样很容易想到反例:1 14,虽然总和也为偶数个但是不成立.这里就延伸出新的规则:1的个数最多的不超过总和的/2.   总结来说就是:\(sum[r]-sum[l-1]\)为偶,且\(maxn_{l,r}<=\frac{sum}{2}\).  

  • Vasya and Golden Ticket2021-07-08 13:33:03

    原题链接 考察:双指针 思路:   枚举和k,求\(sum[r]-sum[l]==k\)的最大r,注意特判0 Code #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 110; int n,sum[N]; char s[N]; bool check(int k) { int l = 0,cnt = 0,r = 0; whi

  • Vasya and Cornfield CodeForces - 1030B2021-07-08 13:02:58

    原题链接 考察:计算几何 思路:   两种方法: 一:线性规划 (1) \(x-d<=y<=x+d\) (2) \(-x+d<=y<=-x+2n-d\) 二:叉乘判别法(只适用于凸多边形)   看这里GO &emps; 没找到证明,但注意外积相乘不是累乘,只与上一个乘就行了. Code(思路二) #include <iostream> #include <cstring> u

  • Codeforces1058 D. Vasya and Triangle(思维,数学)2021-06-01 19:01:38

    题意: 解法: 格 点 三 角 形 的 面

  • CF1030D Vasya and Triangle2021-06-01 09:36:13

    原题链接 题意:在 \(1 \leqslant n \leqslant 1e9, 1\leqslant m \leqslant 1e9, 1 < k \leqslant 1e9\) 的情况下,构造出 \(1\leqslant x \leqslant n, 1 \leqslant y\leqslant m\) 同时三个点构成的三角形面积等于 \(\frac{n\times m}{k}\)。 题解:主要是当在抽象成 \(x\times y

  • Luogu 题解 CF1107F Vasya and Endless Credits2021-04-14 17:34:41

    传送门 题意描述 给定 \(n\) 种贷款,第 \(i\) 种贷款可以让你立即收入 \(a_i\) 元,但接下来的 \(k_i\) 天内每天末尾你都要支出 \(b_i\) 元。你可以在任意时间购买贷款,每个贷款最多可购买一次,每天最多只能购买一个贷款。你手中的金钱可以为负。求在任意时间中你所拥有的金钱的最大值

  • CF1107E Vasya and Binary String(区间dp)2021-03-16 13:05:37

    看数据会猜到是区间dp 这道题的精髓就是相同字符才能删除 我们设计状态为删除f[i][j][k],i-j区间,后面有k个相同的在这次删除中一次删除 那么状态转移,最后一位j可以选择和后面的删掉,或者如果区间内有和j相同的字符,可以与k一起被删掉。 两种转移方式,虽然可能更新的时候有很多非法状态

  • 2021.02.192021-02-24 19:05:14

    CodeForces - 699C  题意:Vasya有n天的假期!因此,他决定提高自己的IT技能并从事体育运动。Vasya知道这n天内每一天的以下信息:该体育馆是否开放以及当天是否在互联网上进行了比赛。对于我第一天有四个选项:   在这一天,健身房关闭,比赛没有进行; 在这一天,健身房关闭,比赛开始; 在这一天,健

  • [CF354C] Vasya and Beautiful Arrays2021-02-03 15:34:26

    [CF354C] Vasya and Beautiful Arrays Description 定义一个数组的美丽度为这个数组所有元素的最大公约数,对于每个元素可以减一个 \(0 \sim k\) 的数,减完以后该元素必须非负,求出这个数组的最大美丽度。 Solution 显然 ans 不会大于最小数,设 ans 等于最小数,循环遍历每个数,如果不符

  • 2020.12.3--vj个人赛补题2020-12-06 17:34:30

    A Vasya studies music.He has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes

  • CodeForces 1093F Vasya and Array2020-08-08 16:02:09

    题意 给一个长度为 \(n\) 的整数序列 \(a\),其中 \(a_i\) 要么为 \(-1\),要么为 \(1\sim k\) 中的整数。 求出将所有 \(-1\) 替换为 \(1\sim k\) 中整数的方案数,满足替换后的序列中不存在连续 \(l\) 个相同的数,对 \(998244353\) 取模。 \(\texttt{Data Range:}1\leq l\leq n\leq 10^

  • [CF从零单排#11]69A - Young Physicist2020-07-25 10:00:13

    题目来源:http://codeforces.com/problemset/problem/69/A A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot t

  • [CF1073C] Vasya and Robot - 尺取法2020-05-06 20:51:17

    Description 在平面直角坐标系中,一个机器人处于 $ (0,0) $ 点。它能进行以下的移动操作。$ U~~ $ 从 $ (x,y) $ 移动到 $ (x,y+1) \(;\) D~~ $ 从 $ (x,y) $ 移动到 $ (x,y-1) \(;\) L~~ $ 从 $ (x,y) $ 移动到 $ (x-1,y) \(;\) R~~ $ 从 $ (x,y) $ 移动到 $ (x+1,y) $。现在有一

  • 尺取法 C - Vasya and String CodeForces - 676C2020-04-18 15:01:54

    C - Vasya and String  CodeForces - 676C  #include<iostream> using namespace std; int main() { long long k,n; cin>>n>>k; string str; cin>>str; long long p=0,ans=0,s=0; for(int i=0;i<n;++i) { i

  • E. Vasya and Good Sequences2020-03-10 21:37:23

    题目 题意:     给出一组序列,对于其中的元素可以任意改变其二进制下1的位置。求出区间[l,r],使得这个区间的元素在操作后异或值为0。输出这样的区间数量。     1≤n≤3⋅105,1≤ai≤10181≤n≤3⋅10^5,1≤a_i≤10^{18}1≤n≤3⋅105,1≤ai​≤1018 分析:     首先对于

  • Codeforces 1053 B - Vasya and Good Sequences2020-01-29 16:06:46

    题: 思路: 满足异或值为0的区间,必须满足一下条件: 1.区间中二进制1的个数和为偶数个; 2.区间二进制1的个数最大值的两倍不超过区间和. #include<bits/stdc++.h> using namespace std; #define pb push_back typedef long long ll; const int M=1e6+5; ll a[10],countt[M]; int main

  • Codeforces Round #610 (Div. 2) B2. K for the Price of One (Hard Version) (DP)2019-12-25 20:57:08

    链接: https://codeforces.com/contest/1282/problem/B2 题意: This is the hard version of this problem. The only difference is the constraint on k — the number of gifts in the offer. In this version: 2≤k≤n. Vasya came to the store to buy goods for his friends f

  • D. Treasure Island2019-11-12 18:50:34

    D. Treasure Island time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output All of us love treasures, right? That's why young Vasya is heading for a Treasure Island. Treasure Island may be rep

  • Vasya and Shifts CodeForces - 832E (高斯消元)2019-10-03 16:04:28

    大意: 给定$4n$个$m$位的五进制数, $q$个询问, 每个询问给出一个$m$位的五进制数$b$, 求有多少种选数方案可以使五进制异或和为$b$.   高斯消元入门题 每次询问相当于就是给定了$m$个式子组成的模$5$的方程组, 求解的个数 如果消元后询问某一位非零, 但是对应系数矩阵全零, 那么

  • A. Vasya and Book2019-08-18 09:56:19

    题目链接:http://codeforces.com/problemset/problem/1082/A   题意: 有一本书,页码是1到n。当前页的页码是x,要翻到第y页。规定:每次只能翻d页,向前向后翻均可。注:翻向第一页或者翻向最后一页的翻页操作可以无视上述规定。   思路: 这题其实就一个简单的模拟题。 总共只可能出现三种情

  • codeforces164A2019-08-03 20:58:05

    Variable, or There and Back Again  CodeForces - 164A  Life is not easy for the perfectly common variable named Vasya. Wherever it goes, it is either assigned a value, or simply ignored, or is being used! Vasya's life goes in states of a program. In

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

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

ICode9版权所有