Codeforces #366 Div. 2 C. Thor (模拟】的更多相关文章

http://codeforces.com/contest/705/problem/C 题目 模拟题 : 设的方法采用一个 r 数组(第几个app已经阅读过的消息的数量),和app数组(第几个app发出的消息的总数),加上一个 q 队列. 思路: 查询==1的时候,入队(记录顺序), sum++ (sum 为全部的剩余 没阅读的数量) 查询==2的时候,针对一个app,sum -(这个app发出的消息的总数 - 这个app已经阅读过的消息的数量),然后用 app数组 更新 r 数组,表示这个ap…
Thor 题意: 第一行n和q,n表示某手机有n个app,q表示下面有q个操作. 操作类型1:app x增加一条未读信息. 操作类型2:一次把app x的未读信息全部读完. 操作类型3:按照操作类型1添加的顺序,按顺序读t条信息,注意这t条信息可能有的已经读过.如果读过也算前t条,会再读一遍. 最后输出每次操作有多少信息没读. 题解: 一看题,要30W,那肯定不可以n^2了,想一想,3种操作,一个vector够用吗,应该不够,所以再加个set,就差不多了.那么思路就是这样的: 首先要有个计数器c…
C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated…
C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated…
https://blog.csdn.net/liangzhaoyang1/article/details/52215276  原博客 原来好像是个dp题,不过我看了别人的博客使用贪心做的 复杂度(n^2) 题意:在一个数轴上有n个点,每个点有5个值x,a,b,c,d,你每次可以从一个点i跳跃到另外一个点j. 如果j在i的右边,则需要花费abs(x[i]-x[j])+c[i]+b[j]. 如果j在i的左边,则需要花费abs(x[i]-x[j])+d[i]+a[j], 一开始你位于s点,你的目的是遍…
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 Beta Round #27 (Codeforces format, Div. 2) http://codeforces.com/contest/27 A #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define sqr(x) ((x)*(x)) #define maxn 1000005 typ…
codeforces #592(Div.2) A Pens and Pencils Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for th…
codeforces #578(Div.2) A. Hotelier Amugae has a hotel consisting of 1010 rooms. The rooms are numbered from 00 to 99 from left to right. The hotel has two entrances - one from the left end, and another from the right end. When a customer arrives to t…
Codeforces #344 Div.2 Interview 题目描述:求两个序列的子序列或操作的和的最大值 solution 签到题 时间复杂度:\(O(n^2)\) Print Check 题目描述:有一个棋盘,对其进行染色,每次染一行或一列,后来的颜色会覆盖原来的颜色,输出最后的棋盘. solution 题解用二维线段树,其实可以不用. 对染色进行离线操作,那么染过的格子.行.列就不用再染了.所以每个格子可以记录四个指针,分别是行前驱,行后继,列前驱列后继,染色时按照这个跳着来染就好了.…
Codeforces #345 Div.1 打CF有助于提高做题的正确率. Watchmen 题目描述:求欧拉距离等于曼哈顿距离的点对个数. solution 签到题,其实就是求有多少对点在同一行或同一列. 时间复杂度:\(O(nlogn)\) Image Preview 题目描述:给定看一张照片的时间,翻页的时间,把图片翻转的时间.一开始屏幕显示第一张照片,可以向左或向右翻,不能跳过还没有看过的图片,方向不对的图片要先翻转再看,看过的不消耗翻转时间与看照片时间,问在一定时间内,最多能看多少张照…
Codeforces#441 Div.2 四小题 链接 A. Trip For Meal 小熊维尼喜欢吃蜂蜜.他每天要在朋友家享用N次蜂蜜 , 朋友A到B家的距离是 a ,A到C家的距离是b ,B到C家的距离是c  (A- >Rabbit   B- >Owl    C ->Eeyore),他不能连续两顿饭都在同一位朋友家里蹭 他现在位于A的家里, 请问他一天最少要跑多少路. 当然是要找一条最短的路折返跑了啊,是不是很简单. #include<bits/stdc++.h> us…
codeforces #577(Div.2) A  Important Exam A class of students wrote a multiple-choice test. There are nn students in the class. The test had mm questions, each of them had 55 possible answers (A, B, C, D or E). There is exactly one correct answer for…
http://codeforces.com/contest/599/problem/D 题意:给出总的方格数x,问有多少种不同尺寸的矩形满足题意,输出方案数和长宽(3,5和5,3算两种) 思路:比赛的时候gg了..其实稍微在纸上推一下.就会得到对于n,m的矩形,一共会有-n*n*n+3*n*n*m+n+3*n*m的方格.数量级是n3. 我们可以实际跑一遍.发现对于x1E18的数量级,n不会超过1442550,1E6,可以搞. 需要注意的是,一个是会爆int,所以记得用long long 另一个是…
C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated…
A. Hulk time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. Th…
这次出的题貌似有点难啊,Div.1的Standing是这样的,可以看到这位全站排名前10的W4大神也只过了AB两道题. A:http://codeforces.com/contest/705/problem/A 题意:输出形如I hate that I love that I hate ......it的句子,输入N表示形容词的个数 #include <map> #include <set> #include <cmath> #include <queue>…
B. Complete the Word time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segmen…
A. Combination Lock time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Scrooge McDuck keeps his most treasured savings in a home safe with a combination lock. Each time he wants to put there…
A. Joysticks time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at…
https://codeforces.com/contest/1121/problem/D 题意 给你一个m(<=5e5)个数的序列,选择删除某些数,使得剩下的数按每组k个数以此分成n组(n*k<=m),存在只要一组满足和目标集合s(|s|<=k)匹配(即集合中存在的数,组内一定存在) 题解 重点:找出至少一组满足要求的数 假设[l,r]内满足要求,还需要满足:\((l-1)/k*k+(m-r)/k*k>=k*(n-1)\),可以用双指针,对于每个l可以处理出最小的r满足要求 这样…
A. Snacktower 题目连接: http://codeforces.com/contest/767/problem/A Description According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct s…
题目链接: C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fasci…
C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are napplications on this phone. Thor is fascinated b…
CF 复仇者联盟场... 水题 A - Hulk(绿巨人) 输出love hate... #include <bits/stdc++.h> typedef long long ll; const int N = 1e5 + 5; int main() { int n; scanf ("%d", &n); printf ("I hate"); for (int i=1; i<n; ++i) { if (i & 1) printf (&…
链接:http://codeforces.com/contest/404/problem/B B. Marathon time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera takes part in the Berland Marathon. The marathon race starts at the stadium…
题意:给定三个操作,1,是x应用产生一个通知,2,是把所有x的通知读完,3,是把前x个通知读完,问你每次操作后未读的通知. 析:这个题数据有点大,但可以用STL中的队列和set来模拟这个过程用q来标记是哪个应用产生的,用set来记录是第几个通知. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include &l…
http://codeforces.com/contest/714/problem/C 题目大意:有t个询问,每个询问有三种操作 ①加入一个数值为a[i]的数字 ②消除一个数值为a[i]的数字 ③给一个字符串s,s中分别表示0和1,0表示目前该位为偶数,1表示目前该位为奇数.然后询问目前数组中和s每一位能匹配的个数.如果数组中目前的该数字比s的len要短,那么我们就在s的左边一直加0.如果数组中的目前的数字比s的len长,那么就在该数组的左边一直加0就好了.问能和s匹配的有几个,并输出 思路:我…
A. Div. 64 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is f…
C. Bus time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches…