CodeForces 699A Launch of Collider】的更多相关文章

题目链接: http://codeforces.com/problemset/problem/699/A 题目大意: 给N个点,向左或向右运动,速度均为1,问最早什么时候有两个点相撞.无解输出-1 题目思路: [模拟] 模拟一下,记录往左往右的位置即可. // //by coolxxx ////<bits/stdc++.h> #include<iostream> #include<algorithm> #include<string> #include<…
枚举相邻两个$a[i]$与$a[i+1]$,如果$s[i]=R$并且$s[i+1]=L$,那么$i$和$i+1$会碰撞,更新答案. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #incl…
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. 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. 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. 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 par…
维护最新的R,遇到L时如果R出现过就更新答案. #include <cstdio> #include <algorithm> using namespace std; int n,x,r=-1,ans=-1; char a[200005]; int main(){ scanf("%d%s",&n,a); for(int i=0;i<n;i++){ scanf("%d",&x); if(a[i]=='R') r=x; el…
Content 有 \(n\) 辆车在一条数轴上,第 \(i\) 辆车在 \(a_i\) 上,每辆车要么向左,要么向右.开始,它们以 \(1\) 个单位每秒的速度在行驶.问你第一次撞车发生在第几秒的时候,或者根本不会撞车. 数据范围:\(1\leqslant n\leqslant 2\times 10^5,0\leqslant x_i\leqslant x_{i+1}\leqslant 10^9\). Solution 我们可以很容易的发现,当且仅当相邻的两个车,左边的向右开,右边的向左开时会发…
好久没做手生了,不然前四道都是能A的,当然,正常发挥也是菜. A:Launch of Collider 题意:20万个点排在一条直线上,其坐标均为偶数.从某一时刻开始向左或向右运动,速度为每秒1个单位长度.输入给出每个点的坐标及其移动的方向,求发生第一次碰撞的时间,若不会碰撞,则输出-1 最先发生碰撞的是一定是初始时相邻的两个点,因此只需对每个点循环一边,判断其是否会与下一个点碰撞,并求出其时间即可. #include<stdio.h> #include<stdlib.h> int…
Problem A Launch of Collider 题目大意 在x轴上有n个点,坐标均为偶数.每个点或向左移动或向右移动,每秒移动距离为1. 使所有点同时开始移动,求最早有点相遇的时间或无解. 解题分析 对于每一个向右移动的点,找右边最近的一个向左的点.向左移动同理. 正反扫两遍即可. 参考程序 #include <map> #include <set> #include <stack> #include <queue> #include <cm…
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…
B. Berland National LibraryTime Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/567/problem/B Description Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of…
Space Golf 题目连接: http://codeforces.com/gym/100803/attachments Description You surely have never heard of this new planet surface exploration scheme, as it is being carried out in a project with utmost secrecy. The scheme is expected to cut costs of c…
C. Registration system Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/4/C Description A new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to…
http://codeforces.com/contest/699 ALaunch of Collider 题意:n个球,每个球向左或右,速度都为1米每秒,问第一次碰撞的时间,否则输出-1 贪心最短时间一定在RL中,R右边一定有L,L左边一定有R // #pragma comment(linker, "/STACK:102c000000,102c000000") #include <iostream> #include <cstdio> #include <…
B. Berland National LibraryTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/567/problem/B Description Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any o…
B. Alternating Current Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/343/problem/B Description Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hu…
Description Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of the collected works of Berland leaders, the library has a reading room. Today was the pilot launch of an automated…
 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…
id=46667" style="color:blue; text-decoration:none">CodeForces - 344D id=46667" style="color:blue; text-decoration:none">Alternating Current Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64…
D. Alternating Current time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in…
链接: https://codeforces.com/contest/1238/problem/B 题意: Ivan plays an old action game called Heretic. He's stuck on one of the final levels of this game, so he needs some help with killing the monsters. The main part of the level is a large corridor (s…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to de…
记录下在Luna下向Launch中添加图标的步骤,以供以后参考,这里我以加入eclipse图标为例: 首先,我们来创建一个desktop文件(Luna中到启动器Launch可以看作是Ubuntu中到桌面) $ scratch-text-editor eclipse.desktop 将以下代码写入文件 [Desktop Entry] Name=Eclipse Type=Application Exec=eclipse Terminal=false Icon=eclipse Comment=Inte…
人生即在于体验,而体验源于去尝试,去折腾,去改变,去塑新.要知道:"过一个平凡无趣的人生实在太容易了,你可以不读书,不冒险,不运动,不写作,不外出,不折腾--但是,人生最后悔的事情就是:我本可以".生活也好,职场也罢,亦同此理:编程则更如其是. 微注 : 如觉此处排版不尽如你意,可移步: Listary Everything Wox Launch Everything Everything Is a filename search engine for Windows. 它作为在win…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is…