Bakery 题目链接: http://codeforces.com/contest/707/problem/B Description Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities. To bake…
A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have decided to watch the best moments of some movie. There are two buttons on your player: Watch the current minute…
A. Contest time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Misha and Vasya participated in a Codeforces contest. Unfortunately, each of them solved only one problem, though successfully sub…
#define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;vector<int>po[100007],col[100007];int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,m,k; cin>>n>>m>>k; int x=0,y=0; for(int i=…
https://codeforces.com/contest/1143/problem/F 题意 有n条形如\(y=x^2+bx+c\)的抛物线,问有多少条抛物线上方没有其他抛物线的交点 题解 \(y=x^2+bx+c=>y+x^2=bx+c\),转换为点\((x,y+x^2)\)在bx+c的直线上 两个点确定一条抛物线,同时也确定了一条直线 需要选择最上面那些点相邻确定的抛物线,所以维护一个上凸包即可 维护上凸包,当前点在前进方向左边需要向后退,cross(a,b)>=0 代码 #inclu…
题目:http://codeforces.com/problemset/problem/1236/D思路:机器人只能按照→↓←↑这个规律移动,所以在当前方向能够前进的最远处即为界限,到达最远处右转,并且下次在该方向无法再移动到更远的地方,因此按照→↓←↑模拟即可,每次移动更新界限 ,无法移动则结束(第一次无法移动可右转,n*m会爆int)          障碍用set存,每次二分寻找能到达最远的地方,并与界限比较 #include<bits/stdc++.h> using namespace…
题目:https://codeforces.com/contest/1236/problem/A 思路:两种操作收益都是3 且都会消耗b 操作2对b消耗较小 则可优先选择操作2 再进行操作1 即可得到最大值 #include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(); //freopen("in.txt","r",stdi…
题目:https://codeforces.com/contest/1236/problem/C 思路:将 n ^ 2 个 lab 平分为 n 个 group group A 和 B 组成的 有序对 ( u , v ) ,u∈A,v∈B 当 u > v 则此有序对有效,求最大值 易发现将1放在group 1,2放在group 2,3放在group 3,......,n放在group n,n+1放在group n,n+2放在group n-2,.......,2n放在group 1,2n+1放在g…
传送门 A. Stones 签到. B. Alice and the List of Presents 单独考虑每个数的贡献即可. 答案为\((2^{m}-1)^n\). C. Labs 构造就类似于: 1 6 7 2 5 8 3 4 9 这样就行了. 证明我也不会,但感觉这样能使得每一行都较为均衡. Code #include <bits/stdc++.h> #define MP make_pair #define fi first #define se second #define sz(…
http://codeforces.com/contest/435/problem/C…