A. Launch of Collider time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n parti…
Codeforces Round 363 Div. 1 题目链接:## 点击打开链接 A. Vacations (1s, 256MB) 题目大意:给定连续 \(n\) 天,每天为如下四种状态之一: 不能进行运动或比赛 可以进行运动但不能比赛 可以进行比赛但不能运动 可以进行比赛或运动 对于每天,可以根据当天的状态选择运动,比赛或休息.但不能连续两天的选择均为运动或均为比赛.求在这 \(n\) 天中最少需要休息多少天. 数据范围:\(n \leq 100\) 简要题解:令 \(f_{i,0},f_…
好久没做手生了,不然前四道都是能A的,当然,正常发挥也是菜. A:Launch of Collider 题意:20万个点排在一条直线上,其坐标均为偶数.从某一时刻开始向左或向右运动,速度为每秒1个单位长度.输入给出每个点的坐标及其移动的方向,求发生第一次碰撞的时间,若不会碰撞,则输出-1 最先发生碰撞的是一定是初始时相邻的两个点,因此只需对每个点循环一边,判断其是否会与下一个点碰撞,并求出其时间即可. #include<stdio.h> #include<stdlib.h> int…
A. Launch of Collider time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n parti…
A题 http://codeforces.com/problemset/problem/699/A 非常的水,两个相向而行,且间距最小的点,搜一遍就是答案了. #include <cstdio> #include <algorithm> using namespace std; struct node { int x;char ch; }s[+]; bool cmp(node& a,node& b) { return a.x<b.x; } int main()…
题目链接:http://codeforces.com/problemset/problem/698/B题意:告诉你n个节点当前的父节点,修改最少的点的父节点使之变成一棵有根树.思路:拆环.题解:http://codeforces.com/blog/entry/46148代码: #include <cstdio> ; int f[maxn], vis[maxn], n, s, cnt, idx; int Find(int x) { vis[x] = ++ idx; while (!vis[ f[…
 Description There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles…
Description There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles l…
题目链接:http://codeforces.com/contest/699/problem/D D. Fix a Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A tree is an undirected connected graph without cycles. Let's consider a root…
题目链接:http://codeforces.com/contest/699/problem/B 题解: 首先统计每行每列出现'*'的次数,以及'*'出现的总次数,得到r[n]和c[m]数组,以及sum,.然后再枚举每一个格子(O(n^2)枚举,反正输入都是枚举的). 对于每一个格子s[i][j]: 1.如果它是'*', 那么当 r[i] + c[j] - 1 = sum 时, 表明炸弹放在这个位置可以炸掉所有的墙. 2.如果它是'.', 那么当 r[i] + c[j] = sum 时, 表明炸…