
思维
文章平均质量分 81
寒江雪里独钓着的蓑笠翁
退役XCPCer,AI搬砖狗
展开
-
Codeforces1023F - Mobile Phone Network - 并查集、思维
题意: n (1≤n≤5⋅105)n\ (1\le n\le 5\cdot 10^5)n (1≤n≤5⋅105) 个点, k (1≤k≤n−1)k\ (1\le k\le n-1)k (1≤k≤n−1) 条未知权值的边,m (1≤m≤5⋅105)m\ (1\le m\le 5\cdot 10^5)m (1≤m≤5⋅105) 条已知权值的原...原创 2018-11-12 14:04:23 · 443 阅读 · 0 评论 -
CF - 817A. Treasure Hunt - 思维
1.题目描述:A. Treasure Hunttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputCaptain Bill the Hummingbird a原创 2017-06-17 20:31:49 · 1153 阅读 · 0 评论 -
CF - 810C. Do you want a date? - 数学+排序+前缀和思维+快速幂取模
1.题目描述:C. Do you want a date?time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLeha decided to move to原创 2017-05-21 16:59:54 · 1080 阅读 · 0 评论 -
CF - 764B - Timofey and cubes - 思维
1.题目描述:B. Timofey and cubestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYoung Timofey has a birthd原创 2017-05-20 15:59:51 · 337 阅读 · 0 评论 -
CF - 808D. Array Division - 二分+暴力+前缀和思维
1.题目描述:D. Array Divisiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya has an array a consist原创 2017-05-18 20:34:45 · 930 阅读 · 0 评论 -
CF - 808B. Average Sleep - 前缀和思维
1.题目描述:B. Average Sleep Timetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt's been almost a week s原创 2017-05-18 20:10:40 · 638 阅读 · 0 评论 -
CF - 807C. Success Rate - 二分+思维+数学
1.题目描述:C. Success Ratetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are an experienced Codefor原创 2017-05-08 21:32:39 · 368 阅读 · 0 评论 -
北理2017校赛 - C.lv棋 - dfs+剪枝
1.题目描述:lv棋时间限制 7s 在集训队中非常流行一种lv棋,这种棋的棋盘是一个n乘m的网格,双方分为进攻方和防守方。 防守方在棋盘上三个点摆下三个棋子(这三个棋子有先后顺序,摆下后位置不能改变),进攻方需要选择一条路径从起点(0,0)走到终点(0,1),每次只能向只能上、下、左、右方向移动,且只能移动一个单位。进攻方经过每一个格子一次且仅一次,且依次原创 2017-05-14 21:59:03 · 817 阅读 · 0 评论 -
CF - 805D. Minimum number of steps - 思维+快速幂
1.题目描述:D. Minimum number of stepstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe have a string of原创 2017-05-05 19:03:43 · 313 阅读 · 0 评论 -
CF - 368B. Sereja and Suffixes - 哈希+思维
1.题目描述:B. Sereja and Suffixestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSereja has an array a, c原创 2017-05-15 18:37:18 · 482 阅读 · 0 评论 -
CF - 519D. A and B and Interesting Substrings - 前缀和思维+map
1.题目描述:D. A and B and Interesting Substringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA and B原创 2017-05-15 18:23:35 · 512 阅读 · 0 评论 -
CF - 799B. T-shirt buying - STL的set应用
1.题目描述:B. T-shirt buyingtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA new pack of n t-shirts cam原创 2017-05-24 18:10:48 · 354 阅读 · 0 评论 -
AtCoder2362 - Splatter Painting - DFS+思维
1.题目描述:B - Splatter PaintingTime limit : 2sec / Memory limit : 256MBScore : 700 pointsProblem StatementSquid loves painting vertices in graphs.There is a simple undirected原创 2017-05-24 18:01:37 · 439 阅读 · 0 评论 -
AtCoder2341 - Increasing Numbers - 二分+思维
1.题目描述:E - Increasing NumbersTime limit : 2sec / Memory limit : 256MBScore : 1300 pointsProblem StatementWe will call a non-negative integer increasing if, for any two adjace原创 2017-05-24 17:55:11 · 344 阅读 · 0 评论 -
CF- 798A. Mike and palindrome - 思维
1.题目描述:A. Mike and palindrometime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMike has a st原创 2017-04-22 21:01:37 · 984 阅读 · 0 评论 -
CF - 803A. Maximal Binary Matrix - 思维+贪心
题目描述:A. Maximal Binary Matrixtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given matrix with原创 2017-05-03 23:11:26 · 397 阅读 · 0 评论 -
CF - 797A. k-Factorization - 思维+贪心+数学
题目描述:A. k-Factorizationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven a positive inte原创 2017-05-03 22:45:30 · 350 阅读 · 0 评论 -
CF - 813A. The Contest - 排序+思维
1.题目描述:A. The Contesttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPasha is participating in a con原创 2017-06-22 21:06:53 · 758 阅读 · 0 评论 -
Codeforces Round #371(Div.1)
Codeforces Round #371(Div.1) Copyright ©2017.7.1-2017.7.3 by Dove! All Rights Reserved.原创 2017-07-03 17:15:46 · 474 阅读 · 0 评论 -
【牛客多校第一场】J - Different Integers
一、题意概述给你 n (1≤n≤105)n (1≤n≤105)n\ (1\leq n\leq 10^5) 个数 a1...n (1≤ai≤n)a1...n (1≤ai≤n)a_{1...n}\ (1\leq a_i \leq n) 并且有 q (1≤q≤105)q (1≤q≤105)q\ (1\leq q\leq 10^5) 次询问,...原创 2018-07-19 18:53:13 · 385 阅读 · 0 评论 -
Codeforces400E - Inna and Binary Logic - 思维、数学
E. Inna and Binary Logic 分类: brute force mathDescription初始给你长度为 n (1≤n≤105)n (1≤n≤105)n\ (1\leq n\leq 10^5) 大小的数组,现在会执行一种操作持续 nnn 轮,每次 ai,j=ai−1,j & ai−1,j+1ai,j=ai−...原创 2018-03-21 10:53:44 · 243 阅读 · 0 评论 -
Codeforces403D - Beautiful Pairs of Numbers - 组合数学、dp
D. Beautiful Pairs of Numbers 分类: combinatorics dpDescription定义这一类数对 (a1,b1),(a2,b2),⋯,(ak,bk)(a1,b1),(a2,b2),⋯,(ak,bk)(a_1,b_1),(a_2,b_2),\cdots,(a_k,b_k) 是美丽的,当它满足:1≤a1≤b1<a2≤b2<⋯&...原创 2018-03-21 10:50:16 · 469 阅读 · 0 评论 -
Codeforeces - 903E. Bipartite Segments - dfs、二分图
E. Bipartite Segments 分类: data structures dfs and similar题意: 给你一个无向图,n(1≤n≤3×105)n(1\leq n\leq 3\times 10^5) 个点,保证没有偶数环,有 q(1≤q≤3×105)q(1\leq q\leq 3\times 10^5) 次询问,每次给出 l rl\ r, 问只保留编号 [l,r][l,r]原创 2017-12-20 16:19:59 · 561 阅读 · 0 评论 -
URAL1040 - Airline Company - dfs+思维
300人委员会的复仇 题目链接 分类:dfs and simiar math1.题意概述给你n个点和m条边构成的图,要你对着m条边进行赋值(为1到m的不重复分配),使得任意点的所有边的gcd的值为1,如果存在方案输出YES和分配方案,否则输出NO。2.解题思路我们考虑去按dfs序去编号,这样可以保证的是,某个点的边被访问,那么相邻的边至少有一条编号是连续的,但是隐隐感觉还缺少点原创 2017-08-07 15:52:18 · 1477 阅读 · 0 评论 -
Codeforces - 834B. The Festive Evening - 思维、模拟
B. The Festive Evening 题目链接 分类:思维、模拟1.题意概述有A~Z的26个入口,现在有n位客人轮流从这些入口进入,同一时刻不会有超过一位客人进入,每个客人进固定的入口,一个入口在第一位客人来的时候打开,在最后一位客人进入之后关闭,一个入口如果是打开的就需要一个守卫,共有k个守卫,问是否存在某个时间段有某个入口开放但没有守卫?2.解题思路这题的实质就是给原创 2017-08-01 23:12:53 · 393 阅读 · 0 评论 -
Codeforces - 493D. Vasya and Chess - 博弈
Vasya and Chess 题目链接 分类:博弈、思维1.题意概述一个n×nn×n的棋盘,白皇后在(1,1)(1,1)处,黑皇后在(1,n)(1,n)处,其余坐标为绿色棋子。皇后每次可以走行、列、对角线,但是要求每一步必须吃掉棋子或者对方皇后。问你这种策略下哪一方最终能够获胜?2.解题思路我们先观察一下规律:当n为2时候,先手(白)必胜当n为3时候,后手(黑)必胜当n为原创 2017-07-05 17:08:08 · 291 阅读 · 0 评论 -
Codeforces - 466C. Number of Ways - 思维、暴力
Number of Ways 题目链接 分类:思维、暴力1.题意概述给你n个数a[1…n],要你找符合条件的i,j(2≤i≤j≤n−1)i,j(2≤i≤j≤n-1),满足∑i−1k=1ak=∑jk=iak=∑nk=j+1ak\sum_{k=1}^{i-1}a_k=\sum_{k=i}^{j}a_k=\sum_{k=j+1}^{n}a_k,求符合条件的i,ji,j的组合数?2.解题原创 2017-07-05 17:22:45 · 362 阅读 · 0 评论 -
Codeforces - 478C. Table Decorations - 思维、贪心
Table Decorations 题目链接 分类:思维、贪心1.题意概述给你三种颜色的气球Red、Green、Black和他们各自的个数,现在每张桌子要用三个气球装饰,要求同一张桌子的气球颜色不能完全相同,现在问你用这些气球能够最多装饰几张桌子?2.解题思路我们不关心具体方案,假设三种颜色气球数量从小到大分别是a,b,ca,b,c,显然如果>c>2(a+b)>c>2(a+b)原创 2017-07-05 17:36:51 · 417 阅读 · 0 评论 -
Codeforces - 590A. Median Smoothing
Median Smoothing 题目链接 分类:思维、构造1.题意概述给你一个长度为n的01串a[1…n],进行多轮变换,每轮操作:b[1]=a[1],b[n]=a[n]b[1]=a[1],b[n]=a[n]位于2…n-1的数b[i]b[i]为a[i−1],a[i],a[i+1]a[i-1],a[i],a[i+1]从大到小排列的中位数现在问你进行多少轮变换后b数组不再发生变化,原创 2017-07-05 18:13:36 · 305 阅读 · 0 评论 -
Codeforces - 500D. New Year Santa Network - 树形dp、数学、思维
New Year Santa Network 题目链接 分类:树形dp、思维、数学1.题意概述给你由n个节点构成的树,有(n-1)条边,随机选取其中三个节点a、b、c,定义dist=dis(a,b)+dis(b,c)+dis(c,a)dist=dis(a,b)+dis(b,c)+dis(c,a),现在有q次操作,每次选取某条边,使得它的边权由原先的wiw_i变成lil_i,问你每次原创 2017-07-05 18:47:25 · 320 阅读 · 0 评论 -
Codeforces - 777A. Shell Game 思维或者模拟
1.题目描述:A. Shell Gametime limit per test0.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBomboslav likes to look out of原创 2017-02-24 22:20:46 · 315 阅读 · 0 评论 -
Codeforces - 593B.Anton and Lines 排序+思维
1.题目描述:B. Anton and Linestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe teacher gave Anton a lar原创 2017-02-23 22:14:59 · 343 阅读 · 0 评论 -
Codeforces - 612D. The Union of k-Segments 排序+思维
1.题目描述:D. The Union of k-Segmentstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are g原创 2017-02-23 22:05:07 · 409 阅读 · 0 评论 -
Codeforces - 558B. Amr and The Large Array - 计数+思维
1.题目描述:time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAmr has got a large array of size n. Amr doesn't原创 2017-02-23 21:33:12 · 314 阅读 · 0 评论 -
Codeforces - 605B. Lazy Student - 构造最小生成树
B. Lazy Studenttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputStudent Vladislav came to his programming e原创 2017-02-20 16:13:22 · 461 阅读 · 0 评论 -
CF - 782C. Andryusha and Colored Balloons - DFS染色问题
1.题目描述:C. Andryusha and Colored Balloonstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn原创 2017-03-10 17:03:21 · 1117 阅读 · 0 评论 -
CF - 801A. Vicious Keyboard - 思维
1.题目描述:A. Vicious Keyboardtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTonio has a keyb原创 2017-04-20 19:50:31 · 583 阅读 · 0 评论 -
CF - 779A. Pupils Redistribution 贪心+思维
1.题目描述:A. Pupils Redistributiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn Berland e原创 2017-02-26 19:56:23 · 272 阅读 · 0 评论 -
HDU5606 tree 并查集+思维
1.题目描述:treeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1406 Accepted Submission(s): 635Problem DescriptionThere is原创 2017-02-26 14:17:56 · 300 阅读 · 0 评论 -
HDU2675 - Equation Again - 二分+思维
1.题目描述:Equation AgainTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1737 Accepted Submission(s): 557Problem Description原创 2017-03-05 15:31:14 · 717 阅读 · 2 评论