CF1037E. Trips】的更多相关文章

题目链接 CF1037E. Trips 题解 每次删点后,对不满足要求的点拓扑 代码 #include<map> #include<queue> #include<vector> #include<cstdio> #include<algorithm> #define rep(a,b,c) for(int a = b;a <= c;++ a) #define gc getchar() #define pc putchar inline in…
题意 题目链接 Sol 倒着考虑!倒着考虑!倒着考虑! 显然,一个能成为答案的子图一定满足,其中任意节点的度数\(>= k\) 那么倒着维护就只用考虑删除操作,如果一个点不合法的话就把它删掉,然后考虑与他相邻的点 如果不合法就继续删 #include<bits/stdc++.h> #define Pair pair<int, int> #define MP make_pair #define fi first #define se second using namespace…
题目大意:一共有n个人,每天早上会有两个人成为朋友,朋友关系不具有传递性,晚上,它们会组织旅游,如果一个人去旅游,那么他不少于$k$个朋友也要和他去旅游,求每天的最大旅游人数 一开始并没有想到反向建图,并查集搞了好久也没出解,看了题解的思路,大概是这样的 转化问题,反向建图,把正序往图里建边换成每次倒序在图里删边. 显然,一开始/删掉边之后,度小于K的点一定不可用,那么把它删掉,和它相连的边也删掉 那么可能这个点删掉以后,和它相连的某个点度也小于K了,再把那个点也删掉...发现这是一个类似于拓扑…
The Trips table holds all taxi trips. Each trip has a unique Id, while Client_Id and Driver_Id are both foreign keys to the Users_Id at the Users table. Status is an ENUM type of (‘completed’, ‘cancelled_by_driver’, ‘cancelled_by_client’). +----+----…
思路不总结了,看过题目自己尝试过之后,看下方代码应该能理解的 SELECT Request_at AS DAY, round( sum( CASE WHEN STATUS = 'completed' THEN 0 ELSE 1 END ) / count(Id), 2 ) AS 'Cancellation Rate' FROM Trips WHERE Client_Id IN ( SELECT Users_Id FROM Users WHERE Banned = 'NO' AND Role =…
 Intergalaxy Trips time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The scientists have recently discovered wormholes — objects in space that allow to travel very long distances between gal…
The Trips table holds all taxi trips. Each trip has a unique Id, while Client_Id and Driver_Id are both foreign keys to the Users_Id at the Users table. Status is an ENUM type of (‘completed’, ‘cancelled_by_driver’, ‘cancelled_by_client’). +----+----…
SQL架构 Create table If Not Exists Trips (Id )) Create table If Not Exists Users (Users_Id ), Role ENUM('client', 'driver', 'partner')) Truncate table Trips insert into Trips (Id, Client_Id, Driver_Id, City_Id, Status, Request_at) values (', 'completed…
题目链接:1037E - Trips 题目大意:有n个人,m天,每天晚上都会有一次聚会,一个人会参加一场聚会当且仅当聚会里有至少k个人是他的朋友.每天早上都会有一对人成为好朋友,问每天晚上最多能有多少人参加聚会.朋友关系不满足传递性. 相当于有n个点,进行m次加边操作,每次操作后附加一个询问,问最大点集的大小,使得点集中每个点的度数均大于等于k 题解:如果直接边加边询问可能比较麻烦,本着“正难则反”的原则,我们可以将题目转化为,初始有m条边,每次操作是先询问当前的答案,再删去一条边. 现在我们就…
[CC-TRIPS]Children Trips 题目大意: \(n(n\le10^5)\)座城市构成一棵树,且树上的每条边的长度\(l_i\)满足\(1\le l_i\le 2\).\(m(m\le10^5)\)个询问,每次询问从\(u\)到\(v\),每天最多开\(p\)公里,至少需要多少天可以到达.注意,晚上必须停留在某座城市,而不能将车停在某两座城市之间. 思路: 当\(p\le100\)时,倍增预处理每个点向上跳到哪些位置,否则直接暴力跳. 源代码: #include<cstdio>…