Codeforces
文章平均质量分 62
SomeOtherTime
这个作者很懒,什么都没留下…
展开
-
CF1826E. Walk the Runway(位图)
位图基本思想就是使64位数Long类型中每一位bit表示大小或存在等关系。表示关系的状态压缩后,能利用硬件的位运算使复杂度优化64倍。思路:该题关键是预处理需要求出在每一行m中,每一列元素的两两大小关系。需要时间复杂为O(m*n^2)。该题中预处理时需要对每一行进行排序,以便后一列利用前一列的结果。位图也可利用语言中自带的库函数。使用位图进行优化,时间复杂度优化为O((m*n^2)/64)。然后在用dp求出最大利润P。原创 2023-07-01 09:14:41 · 233 阅读 · 0 评论 -
注意java long的取模运算速度比int取模运算慢
内层循环最多只能有1个long取模运算,2个就会超时。int取模运算则快很多。原创 2022-08-21 03:15:55 · 777 阅读 · 0 评论 -
CF1707C - DFS Trees (树上差分)
主要是先得到最小生成树,每条多余的边能排除一些最小生成树的点比如上图多余的边是(u,v),就能把u,v以下的点都排除了.差分思想就是用一些特殊点代表一种累计效果.最后在求一次前缀和. 不同情况下细节略有不同.但是怎么在O(n)复杂度得到这些点?,就要用到差分思想,参考。...............原创 2022-08-12 14:49:36 · 228 阅读 · 0 评论 -
CF1045G. AI robots
Problem - G - CodeforcesG. AI robotstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn the last mission, MDCS has successfully shippedNNAI robots to Mars. Before they start explori..原创 2021-11-02 14:26:33 · 227 阅读 · 0 评论 -
CF1557D. Ezzat and Grid(线段树离散化)
https://codeforces.com/contest/1557/problem/DD. Ezzat and Gridtime limit per test2.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMoamen was drawing a grid ofnnrows and109109columns containing onl...原创 2021-08-15 16:19:11 · 179 阅读 · 0 评论 -
CF1056E. Check Transcription
https://codeforces.com/contest/1056/problem/Ehash的进制可以适量大一点,字符a从1开始(如果从0开始可能算出相同的值,比如字符串多个a)。import java.util.*;import java.io.*;public class Main { public static void main(String args[]) { new Main().run(); } FastReader in = n原创 2021-07-23 11:00:31 · 131 阅读 · 0 评论 -
CF999E. Reachability from the Capital(缩点)
https://codeforces.com/contest/999/problem/EThere arenncities andmmroads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities reachabl...原创 2021-06-22 09:14:39 · 137 阅读 · 0 评论 -
CF1404C. Fixed Point Removal
https://codeforces.com/contest/1404/problem/C原创 2021-06-14 08:11:14 · 177 阅读 · 0 评论 -
CF1516D. Cut
https://codeforces.com/problemset/problem/1516/D参考:https://blog.csdn.net/baredman/article/details/116052352https://codeforces.com/contest/1516/submission/113744317线段数一般要固定的区间,所以这题只能倍增。import java.util.*;import java.io.*;public class Main { .原创 2021-04-28 01:46:38 · 368 阅读 · 0 评论 -
CF1500B. Two chandeliers(扩展欧几里得算法)
https://codeforces.com/contest/1500/problem/BB. Two chandelierstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya is a CEO of a big construction company. And as any other big boss原创 2021-03-20 23:12:13 · 630 阅读 · 0 评论 -
CF1316E. Team Building
https://codeforces.com/contest/1316/problem/EE. Team Buildingtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice, the presid...原创 2020-03-09 10:00:52 · 334 阅读 · 0 评论 -
CF1110D. Jongmah
D. Jongmahtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are playing a game of Jongmah. You don't need to know the rules to...原创 2020-03-07 21:06:02 · 268 阅读 · 0 评论 -
CF1187D. Subarray Sorting
You are given an arraya1,a2,…,ana1,a2,…,anand an arrayb1,b2,…,bnb1,b2,…,bn.For one operation you can sort in non-decreasing order any subarraya[l…r]a[l…r]of the arrayaa.For example, ifa=[4,...原创 2020-02-28 15:42:51 · 227 阅读 · 0 评论 -
CF1252K. Addition Robot
time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAdding two numbers several times is a time-consuming task, so you want to build a ...原创 2020-02-15 22:21:43 · 197 阅读 · 0 评论 -
CF1194E. Count The Rectangles(树状数组)
E. Count The Rectanglestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere arennsegments drawn on a plane; theii-th segment...原创 2020-02-09 18:51:18 · 250 阅读 · 0 评论 -
CF893E. Counting Arrays
E. Counting Arraystime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two positive integer numbersxandy. An arrayF...原创 2020-02-08 15:40:46 · 314 阅读 · 0 评论 -
CF1295E. Permutation Separation(线段树+lazy标记)
E. Permutation Separationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutationp1,p2,…,pnp1,p2,…,pn(an ar...原创 2020-02-05 01:29:16 · 519 阅读 · 0 评论 -
codeforces832D. Misha, Grisha and Underground(倍增)
https://codeforces.com/problemset/problem/832/DD. Misha, Grisha and Undergroundtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output...原创 2020-01-26 18:30:24 · 250 阅读 · 0 评论 -
leetcode 1192. Critical Connections in a Network 与 CF1000E. We Need More Bosses
There arenservers numbered from0ton-1connected byundirected server-to-serverconnectionsforming a network whereconnections[i] = [a, b]represents a connection between serversaandb. Any ser...原创 2019-09-15 22:57:41 · 2443 阅读 · 0 评论 -
Codeforces707D. Persistent Bookcase
D. Persistent Bookcasetime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputRecently in school Alina has learned what are thepersiste...原创 2020-01-17 00:57:20 · 221 阅读 · 1 评论 -
Codeforces877 E. Danil and a Part-time Job(dfs序+线段树+lazy标记)
https://codeforces.com/contest/877/problem/EE. Danil and a Part-time Jobtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDanil ...原创 2020-01-15 13:39:47 · 267 阅读 · 0 评论 -
Codeforces920F. SUM and REPLACE
F. SUM and REPLACEtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLetD(x)be the number of positive divisors of a positive inte...原创 2019-12-12 17:50:20 · 124 阅读 · 0 评论 -
codeforces1249F. Maximum Weight Subset
https://codeforces.com/contest/1249/problem/FF. Maximum Weight Subsettime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are g...原创 2019-11-08 11:22:28 · 302 阅读 · 0 评论 -
CF1234D. Distinct Characters Queries(分块)
D. Distinct Characters Queriestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a stringssconsisting of lowercase ...原创 2019-10-24 21:19:18 · 333 阅读 · 0 评论 -
Codeforces1223E. Paint the Tree
https://codeforces.com/contest/1223/problem/EYou are given a weighted tree consisting ofnnvertices. Recall that a tree is a connected graph without cycles. Verticesuiuiandviviare connected by ...原创 2019-10-22 12:45:03 · 285 阅读 · 0 评论 -
Codeforces 1181D. Irrigation
https://codeforces.com/contest/1181/status/DMisha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from a...原创 2019-10-21 15:54:47 · 249 阅读 · 0 评论 -
codeforces 1238E. Keyboard Purchase
https://codeforces.com/contest/1238/problem/EE. Keyboard Purchasetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a pas...原创 2019-10-17 17:40:01 · 755 阅读 · 0 评论 -
Codeforces B - Shortest Cycle(求无向图最小环)
https://codeforces.com/contest/1205/problem/BB. Shortest Cycletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are givennn...原创 2019-08-27 12:14:57 · 216 阅读 · 0 评论 -
Codeforces E. K Balanced Teams(1133E)
E. K Balanced Teamstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are a coach at your local university. There arennstuden...原创 2019-07-18 17:43:45 · 323 阅读 · 0 评论