Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const int MAXN = 200005; int n; char s[MAXN]; int A[MAXN]; int main() { scanf("%d", &n); scanf("%s", s); for (int i = 0; i < n; i++) { scanf("%d", A + i); } int t = 1e9; for (int i = 0; i < n - 1; i++) { if (s[i] == 'R' && s[i + 1] == 'L') { t = mi...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n=int(input()) w=input() p=input().split() b=[] for i in range(len(w)-1): if w[i]=='R': if w[i+1]=='L': b.append((int(p[i+1])-int(p[i]))//2) b.sort() if len(b)>0: print(b[0]) else: print(-1)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
def main(): n = int(input()) s = input() arr, ans = [int(i) for i in input().split()], 99999999999999999 for i in range(len(s)): if s[i] == 'L' and s[i-1] == 'R' and i > 0: ans = min(ans, abs(arr[i] - arr[i - 1]) // 2) print(ans if ans != 99999999999999999 else -1) if __name__ == '__main__': main()
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Solution { public static void main(String[] args) throws IOException { BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); ...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Scanner; public class LaunchOfCollider_699A { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String s = in.next(); int [] arr = new int [n]; int index = -1 ; int ans = -1; arr[0] = in.nextInt(); for (int i = 0 ; i < n-1 ; i++) { ...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int n, r; char d[200010]; int p[200010]; int main() { scanf("%d", &n); scanf("%s", d); for (int i = 0; i < n; i++) scanf("%d", p + i); r = 1000000000; for (int i = 0; i < n - 1; i++) { if (d[i] == 'R' && d[i + 1] == 'L') r = min(r, (-p[i] + p[i + 1]) / 2); }...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> char a[200200]; int main() { int i, j, n, max = 0, p, ans = 2100000000, ch = 0; scanf("%d", &n); for (i = 0; i < n; i++) scanf(" %c", &a[i]); for (i = 0; i < n; i++) { scanf("%d", &p); if (a[i] == 'R') { max = p; ch = 1; } else if (ch == 1) ans = (((ans) < ...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in =new Scanner(System.in); int n=Integer.parseInt(in.nextLine()); String s=in.nextLine(); int []niza=new int[n]; int br=0; for(int i=0;i<n;i++) { niza[i]=in.nextInt(); } int min=Integer.MAX_VALUE; ...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; import java.io.*; import java.awt.geom.*; import java.math.*; public class A { static final Reader in = new Reader(); static final PrintWriter out = new PrintWriter(System.out,false); static boolean debug = false; static void solve(){ int n = in.nextInt(); String s = in.next(); long ans...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; struct node { char fx; long long zb; } point[200005]; long long jl[200005]; long long jl1[200005]; int main() { int n; while (scanf("%d", &n) != EOF) { getchar(); for (int i = 0; i < n; i++) scanf("%c", &point[i].fx); int num = 0, num1 = 0; for (int ...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; vector<int> pos; for (int i = 0; i < n; i++) { int x; scanf("%d", &x); pos.push_back(x); } int ans = 1000000000; for (int i = 0; i + 1 < n; i++) { if (s[i] == 'R' && s[i + 1] == 'L') { ...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import math,sys,bisect,heapq from collections import defaultdict,Counter,deque from itertools import groupby,accumulate #sys.setrecursionlimit(200000000) input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__ ilele = lambda: map(int,input().split()) alele = lambda: list(map(int, input().split())) def list...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
//package Div2A; import java.util.Arrays; import java.util.Scanner; public class evenNum { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String d = sc.next(); int num[] = new int[n]; for (int i = 0; i < num.lengt...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const int N = 200010; char s[N]; int a[N]; int main() { int n, i, ans = 1e9 + 1; cin >> n; scanf("%s", s + 1); for (i = 1; i <= n; i++) scanf("%d", &a[i]); for (i = 1; i < n; i++) if (s[i] == 'R' && s[i + 1] == 'L') ans = min(ans, a[i + 1] - a[i] >> 1); if (...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
N = int(input()) direct = input() coord = list(map(int, input().rstrip().split(' '))) mn = 2e9 for i in range(1, N): if direct[i - 1] == 'R' and direct[i] == 'L': mn = min(mn, ((coord[i] - coord[i - 1])&1 + coord[i] - coord[i - 1]) // 2) if mn != 2e9: print(mn) else: print(-1)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; char c[200001]; int a[200001]; int main() { int n, cnt = 0, ans = 0, mn = 1e9 + 1, k; cin >> n; k = mn; for (int i = 1; i <= n; ++i) { cin >> c[i]; } for (int i = 1; i <= n; ++i) { cin >> a[i]; } for (int i = 1; i <= n; ++i) { if (c[i] == 'R' && ...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); char dir[n + 10]; scanf("%s", dir); int pos[n + 10], i, right = -1, left = -1; for (i = 0; i < n; ++i) { scanf("%d", &pos[i]); if (dir[i] == 'R' && right == -1) right = i; if (dir[i] == 'L') left = i; } long l...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int n, r, dist; string dir; int main() { dist = 1000000001; r = -1; cin >> n; cin >> dir; for (int i = 0; i < n; i++) { int coord; cin >> coord; if (dir[i] == 'R') { r = coord; } else { if ((coord - r < dist) && (r != -1)) { dis...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
""" β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β•šβ•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β•šβ•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•β•β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) dirs = input() pos = list(map(int, input().split())) times = [] for i in range(len(dirs)-1): if dirs[i] == 'R' and dirs[i+1] == 'L': times.append((pos[i+1] - pos[i]) / 2) if times: print(int(min(times))) else: print(-1)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n=int(input()) string=input() l=list(map(int,input().split())) results=[] for i in range(n-1): if string[i]=="R" and string[i+1]=="L": results.append(l[i+1]-l[i]) if len(results) ==0: print(-1) else: print(min(results)//2)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#!/usr/bin/env pypy3 import array import bisect IMPOSSIBLE = -1 INF = 10 ** 10 def compute_collision_time(dirs, xs): ans = INF rights = array.array("L") lefts = array.array("L") for idx, x in enumerate(xs): if dirs[idx] == "R": rights.append(x) else: lefts.ap...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int maxn = 200010; int n; char s[maxn]; int pos[maxn]; int main() { scanf("%d%s", &n, s); for (int i = 0; i < n; ++i) scanf("%d", &pos[i]); int res = INF; for (int i = 1; i < n; ++i) if (s[i - 1] == 'R' && s[i] == 'L') res...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; public class bucky{ public static void main (String args[]) { Scanner input=new Scanner(System.in); HashMap<Integer, Integer> map= new HashMap<Integer, Integer>(); String nn=input.nextLine(); int n=Integer.parseInt(nn); String str=input.nextLine(); int nums[]=new int[n+1]; ...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) direcoes = input() posicoes = input().split() posicoes = [int(x) for x in posicoes] marcacoes = [] for i in range(0, len(direcoes)-1): if direcoes[i] == 'R' and direcoes[i+1] == 'L': marcacoes.append(i) if marcacoes == []: print(-1) else: tempos = [(posicoes[x+1]-posicoes[x]) fo...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import math n = int(input()) s = input() arr = input().split() l = -1 ind = 0 counter = 0 len_n = len(s) while(counter<len_n): ind = s.find('RL', ind) counter += 1 if (ind == -1): break else: x = int(arr[ind+1]) + int(arr[ind]) tmp = int(arr[ind+1])-int(x/2) ...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class A699 { public static void main(String[] args) throws NumberFormatException, IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); S...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; struct myhash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
//package test; import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String a = new String(); a = sc.next(); int[] D = new int[n]; for (int i=0; i<n; i++){ D[i] = ...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int arr[200009]; int main() { int n, a, b, i, z = 1000000009, k; string s; cin >> n >> s; for (int i = 0; i < n; i++) cin >> arr[i]; for (int i = 0; i < n - 1; i++) { if (s[i] == 'R' && s[i + 1] == 'L') k = (arr[i + 1] - arr[i]) / 2; z = min(z, k); } i...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(raw_input()) commands = list(raw_input()) coords = map(int, raw_input().split()) min_dist = 10 ** 10 left, right = -1, - 1 for i in range(n): if commands[i] == 'R': right = i else: left = i if right < left and right != -1: min_dist = min(min_dist, (coords[left] - coords[righ...
PYTHON
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) s = list(input()) x = list(map(int,input().split())) ans = 10**10 for i in range(n-1): if s[i] == "R" and s[i+1] == "L": ans = min(ans, (x[i+1] - x[i]) // 2) if ans > 10 ** 9: ans = -1 print(ans)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
__author__ = 'Alexander' import sys n = int(sys.stdin.readline()) direct = sys.stdin.readline() positions = sys.stdin.readline().split() if direct.find('RL') == -1: sys.stdout.write("-1") else: start = 0 expl = 1000000000 pos = direct.find('RL') while pos != -1: start += pos expl = m...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n=input() s=str(raw_input()) lst=map(int,raw_input().split()) f=[] for i in range(0,n): if s[i]=="L": f.append(-1) else: f.append(1) ans=100000000000000 if n==1: print -1 else: for i in range(1,n+1): if i==1: if (f[1]-f[0])<0: ans=min(ans,abs(lst...
PYTHON
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n=int(input()) s=input() a=list(map(int,input().split())) d=[] for i in range(n-1): if s[i]=='R' and s[i+1]=='L': t=a[i+1]-a[i] t=t//2 d.append(t) if d==[]: print(-1) else: print(min(d))
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Scanner; import static java.lang.Math.min; public class LaunchOfCollider { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); ...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
// 2016-07-19 16:49 import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.Set; import java.util.TreeSet; public class ...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; import java.io.*; public class Main{ Scanner sc; public static void main(String[] args) throws IOException{ new Main().run(); } public void run() throws IOException{ sc = new Scanner(System.in); int n = sc.nextInt(); String[] m = sc.next().split(""); int[] num = new int[n]; ...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
# https://codeforces.com/contest/699/problem/A n = int(input()) particles = input() positions = map(int, input().split()) temp = None ans = float('inf') for p, x in zip(particles, positions): if temp is None: if p == "R": temp = x else: if p == "R": temp = x if...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) s = input() x = list(map(int, input().split())) ans = float('inf') last = None for i in range(n): if s[i] == 'R': last = x[i] elif last != None: cur = (x[i] - last) // 2 ans = min(ans, cur) if ans == float('inf'): ans = -1 print(ans)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { long long n; string s; cin >> n >> s; vector<long long> a(n); for (long long i = 0; i < n; i++) cin >> a[i]; size_t found = s.find("RL"); if (found == string::npos) { cout << -1; return 0; } long long t = 1 + 1e9; while (found != str...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; import java.io.*; import java.math.BigInteger; public class _practise { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st....
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(raw_input()) s = raw_input() x = map(int, raw_input().split()) ans = None pp, pd = None, None for p, d in sorted(zip(x, s)): if pd == 'R' and d == 'L': if ans is None or 2 * ans > p - pp: ans = (p - pp) // 2 pp, pd = p, d if ans is None: print '-1' else: print ans
PYTHON
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#!/usr/bin/env python #-*-coding:utf-8 -*- n=int(input())-1 D=input() C=tuple(map(int,input().split())) m=INF=1<<30 for i in range(n): if 'R'==D[i] and 'L'==D[1+i]:m=min(m,C[1+i]-C[i]) print(m>>1 if INF>m else -1)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using std::cerr; using std::cin; using std::clog; using std::cout; using std::pow; using std::priority_queue; using std::stack; using std::string; using std::unordered_map; using std::unordered_set; using std::vector; vector<string> &split(const string &s, char delim, vector<string> &elems) { ...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> int main() { int i, n, min = 1000000001, count = 0, a[200001] = {0}; char s[200001]; scanf("%d", &n); scanf("%s", s); for (i = 0; i < n; i++) { scanf("%d", &a[i]); } for (i = 0; i < n; i++) { if (s[i] == 'R' && s[i + 1] == 'L') { count = 1; if (min > (a[i + 1] ...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(raw_input()) d = raw_input() a = map(int, raw_input().split(' ')) m = -1 for i in xrange(n - 1): if d[i] == 'R' and d[i + 1] == 'L': dif = (a[i+1] - a[i])/2 if m == -1 or m > dif: m = dif print m
PYTHON
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; long long int ar[500009], br[500009]; int main() { long long int a, b, c, i, j = 0, k = 9999999999999; string s; cin >> a; getchar(); cin >> s; for (i = 0; i < a; i++) { cin >> ar[i]; } for (i = 0; i < a - 1; i++) { if (s[i] == 'R' && s[i + 1] == 'L'...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.*; import java.util.*; public class A1008 { public static void main(String [] args) /*throws Exception*/ { InputStream inputReader = System.in; OutputStream outputReader = System.out; InputReader in = new InputReader(inputReader);//new InputReader(new FileInputStream(new File...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<char> way; bool NoColision = true; for (int i = 0; i < n; i++) { char temp, t; cin >> temp; way.push_back(temp); if (NoColision && i > 0) { if (t == 'R' && temp == 'L') NoColision = false; } t = te...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import os import sys from atexit import register from io import BytesIO sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size)) sys.stdout = BytesIO() register(lambda: os.write(1, sys.stdout.getvalue())) input = lambda: sys.stdin.readline().rstrip('\r\n') # ref. https://codeforces.com/blog/entry/71884 # 1) inp(), For t...
PYTHON
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Main { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int test = Integer.parseInt(br.readLin...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) particles = input() dis = list(map(int, input().split())) num = particles.count('RL') if num == 0: print(-1) else: ans = 10**18 curr_idx = 0 while num != 0: idx = particles[curr_idx:].index('RL') + curr_idx diff = (dis[idx+1] - dis[idx]) // 2 ans = min(diff, ans...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int n; char dir[200005]; int l[200005], r[200005], ll, rl; int ans = 0x7fffffff; int main() { cin >> n; getchar(); for (int i = 1; i <= n; i++) scanf("%c", &dir[i]); for (int i = 1; i <= n; i++) if (dir[i] == 'L') scanf("%d", &l[++ll]); else scan...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) d = input() x = list(map(int, input().split())) ans = -1 for i in range(n-1): if d[i] == 'R' and d[i+1] == 'L' and x[i] < x[i+1]: a = (x[i+1] - x[i])/2 if ans == -1: ans = a elif a < ans: ans = a elif d[i] == 'L' and d[i+1] == 'R' and x[i] > x[i+...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) sr = input() ans = 10**9 arr = list(map(int,input().split())) for i in range(n-1): m = arr[i+1]-arr[i] if sr[i+1]=="L" and sr[i]=="R": temp = m//2 if temp < ans: ans=temp if ans!=10**9: print(ans) else: print("-1")
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
input() t, dirs, X = 500000001, input(), list(map(int, input().split())) for dir1, dir2, x1, x2 in zip(dirs, dirs[1:], X, X[1:]): t = min(t, (x2 - x1) // 2) if dir1 + dir2 == 'RL' else t print(t if t < 500000001 else -1)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Ou...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.*; import java.util.*; import java.text.*; import java.math.*; public class main { public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static PrintWriter pw = new PrintWriter(System.out); public static String line; public static StringTokenizer ...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) directions = list(input()) cordinates = list(map(int, input().split())) distance = 1000000000000 for i in range(0,n): if i < n and i+1 < n and directions[i] == 'R' and directions[i+1] == 'L': if cordinates[i+1] - cordinates[i] < distance: distance = cordinates[i+1] - cordinat...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; char jilu[210000]; int pos[210000]; int ans = 1e9 + 1; int main() { int n; bool ok = 0; int bf = -1; scanf("%d%s", &n, jilu + 1); for (int i = 1; i <= n; i++) { scanf("%d", &pos[i]); } for (int i = 1; i <= n; i++) { if (jilu[i] == 'L') { if (bf !...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> int main() { int n, a[200000], i, min = 1000000000, c = 0; char s[200001]; scanf("%d%s", &n, s); for (i = 0; i < n; i++) scanf("%d", &a[i]); for (i = 0; i < n - 1; i++) if (s[i] == 'R' && s[i + 1] == 'L') { c++; if ((a[i + 1] - a[i]) / 2 < min) min = (a[i + 1] - a[i]) ...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
# -*- coding: utf-8 -*- n = int(raw_input()) s = raw_input() a = map(int, raw_input().split()) Min = 1e9+10 for it in range(n-1): if s[it] == 'R' and s[it+1] == 'L': tmp = (a[it+1]-a[it])/2 if tmp < Min: Min = tmp if Min == 1e9+10: Min = -1 print Min
PYTHON
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int n; char s[200010]; int a[200010]; int main() { scanf("%d", &n); scanf("%s", s); for (int i = 0; i < n; i++) scanf("%d", &a[i]); bool flag = false; int pos = 0, tmp = 1000000000; while (pos < n && s[pos] == 'L') pos++; if (pos < n) { for (int i = pos + ...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import time n = int(input()) N = [i for i in input()] x = [int(i) for i in input().split()] start = time.time() flag = False ans = float('Inf') for i in range(n): if N[i] == 'R': left = i flag = True elif flag == True: buf = x[...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import collections s = int(input()) d = input() x = [int(x) for x in input().split()] m = max(x) - min(x) cnt = 0 res = [] if "RL" not in d: print(-1) else: for i in range(len(d)-1): if d[i] == 'R' and d[i+1] == "L": res.append(int(abs((x[i] - x[i+1]) / 2))) print(min(res))
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) move = input() pos = list(map(int, input().split(' '))) min_monent = 1e20 for i in range(1, n): if move[i] == move[i-1] or (move[i-1] == 'L' and move[i] == 'R'): continue else: middle = (pos[i] + pos[i-1]) / 2 time = max(pos[i], pos[i-1]) - middle min_monent =...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-9; const int INF = 1 << 30; int vis[200005]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, flag = 0; cin >> n; string s; long long int ar[200005], cnt = 1000000002; cin >> s; for (int i = 0; i < ...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout << fixed << setprecision(0); long long n, ans = 0; cin >> n; string s; cin >> s; vector<long long> coor(n); for (int i = 0; i < n; i++) { cin >> coor[i]; } int i = 0; for (i; i <...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import sys n = input() movement = raw_input() distance = map(int, raw_input().split()) if n == 1: print -1 sys.exit(0) min_distance = 3000000000 collide = False for i in range(0, n-1): if movement[i] == 'R' and movement[i+1] == 'L': collide = True current_distance = distance[i+1] - dista...
PYTHON
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; vector<long long int> v; cin >> n; long long int temp; cin >> s; for (int i = 0; i < n; i++) { cin >> temp; v.push_back(temp); } long long int min = 999999999; int flag = 0; for (int i = 0; i < s.size() - 1; i++) {...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Scanner; public class JavaApplication17 { static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int n = scanner.nextInt() , num=Integer.MAX_VALUE , t=0; String s=scanner.next(); int arr[] = new int[n]; ...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; vector<long long> v, k; int main() { int n; cin >> n; long long t; char o; for (int i = 0; i < n; i++) { cin >> o; if (o == 'R') k.push_back(0); else k.push_back(1); } for (int i = 0; i < n; i++) { cin >> t; v.push_back(t); } ...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = input() d = raw_input() l = list() r = list() for i, x in enumerate(map(int, raw_input().split())): if d[i] == 'R': r.append(x) else: l.append(x) j = 0 m = -2 for x in r: while j < len(l) and l[j] < x: j += 1 if j < len(l) and (m < 0 o...
PYTHON
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import math n = int(raw_input()) s = raw_input() x = map(int, raw_input().split()) ans = float('inf') for i in range(n-1): if (s[i]=='R' and s[i+1]=='L'): ans = min(ans, (x[i+1]-x[i])) if (ans > 10**9): print -1 else: print ans/2
PYTHON
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); long[] a = new long[n]; for(int i = 0;i < n;i++){ a[i] = sc.nextLong(); } long min = Long.MAX_VALUE; for(int i = 0;i < n - 1;i++){ ...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
def main(): n = int(input()) d = input() o = list(map(int, input().split())) res = -1 for i in range(n-1): if (d[i], d[i+1]) == ('R', 'L'): cur = (o[i+1] - o[i]) // 2 if res == -1 or res > cur: res = cur print(res) if __name__ == '__main__': ...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) d = input() pos = list(map(int, input().split())) ans = 10**11 for i in range(0, n - 1): if d[i] == 'R' and d[i + 1] == 'L': ans = min(ans, (pos[i + 1] - pos[i]) // 2) if ans == 10**11: ans=-1 print(ans)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) s = input() x = list(map(int, input().split())) mi = float('inf') L, R = float('inf'), float('inf') for i in range(n): if s[i] == 'R': mi = min(mi, abs(x[i] - L) // 2) R = x[i] else: mi = min(mi, abs(x[i] - R) // 2) if mi == float('inf'): print(-1) else: print(m...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class LaunchOfCollider { public static void main(String[] args) { BufferedReader bf = null; try { bf = new BufferedReader(new InputStreamReader(Syst...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Scanner; public class Mountain { public static void main(String[] args) { Scanner in = new Scanner(System.in); int z=in.nextInt(); int[] x=new int[z+1]; int y=0; String s =in.next(); int min=0; for(int i=0;i<z;i++){ x[i]=in.nextInt(); } int counter=0; for(int i=0 ;i<z-1;i++){ ...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
def arr_inp(): return [int(x) for x in input().split()] n, s = int(input()), input() a = arr_inp() m, c1 = 10 ** 9 + 1, 0 while (s.find('RL', c1) != -1): ix = s.find('RL', c1) m = min(m, (a[ix + 1] - a[ix]) // 2) c1 =ix+2 if (c1 == 0): exit(print(-1)) print(m)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = input() d = raw_input() x = map(int, raw_input().split()) print min([(x[i+1]-x[i])/2 for i in xrange(n-1) if d[i:i+2]=="RL"]) if d.count("RL") else -1
PYTHON
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class LaunchOfCollider implements Closeable { private InputReader in = new InputReader(System.in)...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int m = 1000000000 + 10; struct particle { char dir; int x; } P[200000 + 10]; int main() { int n, i, j, k; cin >> n; for (i = 0; i < n; i++) cin >> P[i].dir; for (i = 0; i < n; i++) cin >> P[i].x; for (i = 0; i < n - 1; i++) { if (P[i].dir == 'R' && P[i + ...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n=int(input()) s=input() x=input() ll=x.split(' ') l=[] for i in ll: l.append(int(i)) mn=1000000000 for i in range(n-1): if s[i]=='R' and s[i+1]=='L': mnn=abs(l[i+1]-l[i])//2 if mnn<mn: mn = mnn if mn==1000000000: print(-1) else: print(mn)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n=int(input()) s=input() a=list(map(int,input().split())) l=[a[i+1]-a[i] for i in range(n-1) if s[i]=='R' and s[i+1]=='L'] if l: print(min(l)//2) else: print(-1)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; public class CF699A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[] direc;// = new char[n]; int[] arr = new int[n]; direc = sc.next().toCharArray(); for(int i = 0;i<n;i++) arr[i] = sc.nextInt(); if(n==1) System.out.pri...
JAVA
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) s = input() x = list(map(int, input().split())) min = -1 for i in range(n-1): if s[i]=='R' and s[i+1]=='L': cur = (x[i+1]-x[i])//2 min = cur if cur < min or min == -1 else min print(min)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n=int(input().strip()) s=input().strip() a=[int(i) for i in input().strip().split()] ans=int(1e9) flag=1 for i in range(0,n-1): if s[i]=='R' and s[i+1]=='L': flag=0 ans=min(ans,(a[i+1]-a[i])//2) if flag: print(-1) else: print(ans)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) d = input() x = list(map(int, input().split())) mi = 2**50 for i in range(1, n): if d[i-1] == 'R' and d[i] == 'L': mi = min(mi, (x[i] - x[i-1]) // 2) if mi == 2**50: print(-1) else: print(mi)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
a = int(input()) s = input() l = list(map(int,input().split())) ans = [] for i in range(len(s) - 1): if s[i] == "R" and s[i + 1] == "L": ans.append((l[i + 1] - l[i]) // 2) if len(ans) == 0: print(-1) exit() print(min(ans))
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import sys n = int(input()) directions = input() coordinates = [int(x) for x in input().split()] min_time = sys.maxsize * 2 + 1 max_r = -sys.maxsize * 2 for i in range(len(coordinates)): if directions[i] == 'L': if min_time > (coordinates[i] - max_r) // 2: min_time = (coordinates[i] - max_r) ...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n, m, p = input(), 10 ** 9, -1 s = raw_input() a = map(int, raw_input().split()) k = m for i in range(n): if s[i] == 'R': p = a[i] elif p != -1: m = min(m, (a[i] - p) / 2) print m if m != k else -1
PYTHON
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long n; cin >> n; vector<pair<unsigned long long, char>> p(n); string s; cin >> s; for (unsigned long long i = 0; i < n; i++) { p[i].second = s[i]; } for (unsigned long long i = 0; i < n; i++) { unsigned long long num; ...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; void init() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int arr[200005]; int main() { init(); int n; string s; cin >> n >> s; for (long long int(i) = (0); (i) < (n); ++(i)) { cin >> arr[i]; } int mins = INT_MAX; for (long l...
CPP
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import math,sys,re,itertools rs,ri,rai=input,lambda:int(input()),lambda:list(map(int, input().split())) n = ri() s = rs() xa = rai() p = None mini = float("inf") for ch, x in zip(s, xa): if p is None: if ch == 'R': p = (ch, x) continue if ch == 'R': if p[0] == 'R': ...
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(raw_input()) dir = raw_input() pos = map(int, raw_input().split()) min_dist = -1 for i in range(1,n): if dir[i] == 'L' and dir[i-1] == 'R': dist = (pos[i] - pos[i-1]) / 2 if dist < min_dist or min_dist == -1: min_dist = dist print min_dist
PYTHON
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import math n = int(input()) s = input() l1 = list(map(int,input().split())) min1 = math.inf ind = -1 for i in range(len(s)-1): if s[i]=="R" and s[i+1]=="L": d = l1[i+1]-l1[i] if d<min1: min1 = d ind = i if ind!=-1: print(min1//2) else: print(-1)
PYTHON3
699_A. Launch of Collider
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 located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; public class test { public static void main(String[] args) { Scanner input = new Scanner(System.in); long n = Integer.valueOf(input.nextLine()); String dir = input.nextLine(); int l = -1 , r = -1 ; int rt = (int)1e9 + 1 ; for(int i = 0 ; i<dir.le...
JAVA