codeforces 975C Valhalla Siege】的更多相关文章

题意: 有n个巫师站成一列,每个巫师有自己的血量. 一个人射箭攻击他们,每次造成若干点伤害,巫师按照给定的顺序承受伤害,如果伤害大了,那么死掉,伤害落到下一个巫师身上. 如果一轮攻击之后,所有的巫师都死了,那么他们会立即复活. 给出若干个询问,问每轮攻击之后还剩多少巫师活着. 思路: 前缀和加二分,每次伤害累加,大于了总和便归零且复活. 代码: #include <stdio.h> #include <string.h> #include <algorithm> usi…
Examples input 5 5 1 2 1 2 1 3 10 1 1 1 output 3 5 4 4 3 input 4 4 1 2 3 4 9 1 10 6 output 1 4 4 1 Note In the first example: after the 1-st minute, the 1-st and 2-nd warriors die. after the 2-nd minute all warriors die (and all arrows left over are…
C. Valhalla Siege time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ivar the Boneless is a great leader. He is trying to capture Kattegat from Lagertha. The war has begun and wave after wave…
C. Valhalla Siege time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ivar the Boneless is a great leader. He is trying to capture Kattegat from Lagertha. The war has begun and wave after wave…
题意略. 思路:这题考察的是二分搜索. #include<bits/stdc++.h> #define maxn 200005 using namespace std; typedef long long LL; LL n,q; LL ai[maxn],ki[maxn]; int main(){ scanf("%lld%lld",&n,&q); ;i < n;++i) scanf("%lld",&ai[i]); ;i <…
A. Aramic script 题目大意:   对于每个单词,定义一种集合,这个集合包含且仅包含单词中出现的字母.给你一堆单词,问有多少种这种集合. 题解:   状压,插入set,取size #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <set> #include &…
题目链接:http://codeforces.com/contest/975 A. Aramic script time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output In Aramic language words can only represent objects. Words in Aramic have special pro…
A. Aramic script time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In Aramic language words can only represent objects. Words in Aramic have special properties: A word is a root if it does no…
2018/5/6 Codeforces Round #478 (Div. 2) C http://codeforces.com/contest/975/problem/C Valhalla Siege 题意:n的士兵,每个士兵有一些生命值,有q次询问,每次询问从前向后造成ki点贯穿伤害(生命值归零的士兵死去,后续士兵承受溢出伤害),问每次询问有几个士兵还活着.当所有士兵死去时,不继续造成溢出伤害并且所有士兵复活. 思路:二分搜索,对士兵生命值求前缀和,每次询问造成的伤害累计,记为s,用upper…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…