Codeforces 97.B Superset】的更多相关文章

A set of points on a plane is called good, if for any two points at least one of the three conditions is true: those two points lie on same horizontal line; those two points lie on same vertical line; the rectangle, with corners in these two points,…
题意 给你一个有 \(n\) 个点 \(m\) 条边的无向图,有 \(q\) 次询问,每次询问两个点 \(u, v\) 之间是否存在长度为奇数的简单路径. \(1 \le n, m, q \le 10^5\) 题解 显然我们可以对于每个联通块单独处理,如果 \(u, v\) 不联通显然就不存在这条路. 然后对于每个联通块,首先随便弄一颗生成树. 如果这 \(u \to v\) 在树上的路径长就为奇数,显然是可以的,这个可以预处理深度就行了. 否则,\(u \to v\) 在树上的路径的边,只要存…
C. Replacement time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Re…
C. Zero-One 题目连接: http://codeforces.com/contest/135/problem/C Description Little Petya very much likes playing with little Masha. Recently he has received a game called "Zero-One" as a gift from his mother. Petya immediately offered Masha to pla…
B. Rectangle and Square 题目连接: http://codeforces.com/contest/135/problem/B Description Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise di…
A. Replacement 题目连接: http://codeforces.com/contest/135/problem/A Description Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a…
题目链接:https://codeforces.com/contest/1437/problem/E 题意 给出一个大小为 \(n\) 的数组 \(a\) 和一个下标数组 \(b\),每次操作可以选择数组 \(b\) 外的任意下标 \(i\) 并将 \(a_i\) 赋值为任意数,问能否经过操作使得数组 \(a\) 严格递增,如果可以,计算所需的最少操作次数. 题解 令 \(c_i = a_i - i\),如果数组 \(a\) 严格递增,那么数组 \(c\) 一定为非递减序. 所以判断下标数组 \…
比赛链接:https://codeforces.com/contest/1437 A. Marketing Scheme 题解 令 \(l = \frac{a}{2}\),那么如果 \(r < a\),每个顾客都会买更多猫粮. 代码 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t;…
B 判矩阵的时候 出了点错 根据点积判垂直 叉积判平行 面积不能为0 #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdlib.h> #include<vector> #include<cmath> using namespace std; struct node { int x,y; }p[]; ]…