https://codeforces.com/contest/1080/problem/F 题意 有k个区间,区间的种类有n种,有m个询问(n,m<=1e5,k<=3e5),每次询问a,b,x,y,代表对于种类编号为[a,b]的每一种区间,是否都存在一个区间x<=l,r<=y,输出yes or no 思路 现将区间按左端点从小到大排序,对于每一个询问首先找出第一个左端点大于x的区间,然后看[a,b]中最大的右端点是否>y即可 需要一颗以种类编号为下标,右端点为权值的主席树,维…
C. Masha and two friends time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently, Masha was presented with a chessboard with a height of nn and a width of mm. The rows on the chessboard ar…
B. Margarite and the best present 题目链接:https://codeforces.com/contest/1080/problem/B 题意: 给出一个数列:an=(-1)n,之后有询问,问 [l,r] 之间的ai和为多少. 题解:这个分情况讨论一下就可以了,区间长度的奇偶数丶左端点的奇偶数. 代码如下: #include <cstdio> #include <cstring> #include <algorithm> #include…
A. Petya and Origamitime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. Fo…
A. Petya and Origami Water. #include <bits/stdc++.h> using namespace std; #define ll long long ll n, k; ll Get(ll x) { ? (x * n) / k : (x * n) / k + ; } int main() { while (scanf("%lld%lld", &n, &k) != EOF) { ll res = Get() + Get()…
C. Masha and two friends 题目链接:https://codeforc.es/contest/1080/problem/C 题意: 给出一个黑白相间的n*m的矩阵,现在先对一个子矩阵颜色变为白色,然后再对一个子矩阵颜色变为黑色,问最终白色格子和黑色格子有多少? 题解: 定义w(a,b)为(1,1)到(a,b)中白色的数量,通过观察找规律可以发现w(a,b)=((b+1)/2)*((a+1)/2)+(b/2)*(a/2). 然后b(a,b)就是格子总数量减去w(a,b). 现…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/output 1 s, 256 MB x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB x1462 C Vasya and String standard input/output 1 s, 256 MB x1393…
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... 其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/output 1 s, 256 MB x2377 B Queue standard input/output 2 s, 256 MB x1250 C Hacking Cypher standard input/output 1 s, 256 MB x740 D Chocolate standard in…
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his info…
Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Victor adores the sets theory. Let us remind you that a set is a group of…