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
import java.io.*; import java.util.InputMismatchException; public class Cf1907A { private static InputReader in = new InputReader(System.in); private static OutputWriter out = new OutputWriter(System.out); private static void solve() throws Exception { int n = in.readInt(); String s = 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 main() { long long n, i, max = INT_MAX; string s; cin >> n >> s; long long arr[n]; for (i = 0; i < n && cin >> arr[i]; i++) ; for (i = 0; i < s.size(); i++) { if (s[i] == 'R' && s[i + 1] == 'L') max = min(max, (arr[i + 1] - arr[i]) / 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
n=int(input()) s=input() a=[int(x) for x in input().split()] mind=1000000001 for i in range(0,n-1): if s[i]=='R' and s[i+1]=='L': d=a[i+1]-a[i] if mind>d: mind=d if mind==1000000001: print(-1) else: print (mind//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
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; vector<int> x(n); for (int i = 0; i < n; i++) cin >> x[i]; int ret = 1e9; for (int i = 1; i < n; i++) { if (s[i - 1] == 'R' && s[i] == 'L') { ret = min(ret, (x[i] - x[i - 1]) / 2); } } if (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
import java.io.*; import java.util.*; public class CF699A { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); char[] cc = br.readLine().toCharArray(); int[] aa = new int[n]; StringTok...
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.BufferedInputStream; import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.TreeSet; /** * Created by leen on 7/19/16. */ public class _699A { public static void main(String[] args) { Scanner scan = new Scanner(new BufferedInputStream(System.in, 1024 ...
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 inf = 1000000001; char s[200005]; int a[200005], b[200005]; int main() { int i, n, ans = inf + 1; scanf("%d", &n); scanf("%s", s + 1); for (i = 1; i <= n; i++) { scanf("%d", &a[i]); b[i] = (s[i] == 'L' ? 0 : 1); } for (i = 1; i < n; i++) 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()) s=input() a=list(map(int,input().split())) res=[a[i+1]-a[i] for i in range(n-1) if s[i]=='R' and s[i+1]=='L'] if(res): print(int(min(res)/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
#include <bits/stdc++.h> using namespace std; int *v; vector<int> xl, xr; int main() { int n; scanf("%d", &n); string str; cin >> str; xl.clear(); xr.clear(); v = new int[n]; bool r = false, l = false; for (int i = 0; i < n; i++) { int x; scanf("%d", &x); if (str[i] == 'R') xr.push_b...
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()) m=str(input()) o=[int(i) for i in input().split()] min=1000000000 for i in range(0,len(m)-1): if(m[i]=="R" and m[i+1]=="L"): time=((o[i+1]-o[i])/2) if(time<min): min=time if(min==1000000000): print(-1) else: print(int(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()) #n, m = map(int, input().split()) s = input() c = list(map(int, input().split())) l = 10 ** 10 for i in range(1, n): if s[i] == 'L' and s[i - 1] == 'R': l = min(l, c[i] - c[i - 1]) if l == 10 ** 10: print(-1) else: print(l // 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.*; import java.math.BigDecimal; import java.util.*; public class A implements Runnable { private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; private BufferedReader in; private PrintWriter out; private StringTokenizer tok = new 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
import java.util.Scanner; public class Cf { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); String S= input.next(); int array[]= new int [n]; for(int i =0 ;i<n ; i++){ array [i]= input.nextInt(); } boolean collision=false; int distance=1000000000; f...
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() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n, t, min = -1, flag = 0; cin >> n; string s; cin >> s; long long int a[n]; for (int i = 0; i < n; i++) { cin >> t; a[i] = t; } for (int i = 1; i < n; i++) { if ((s[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; long long n, pos[200007]; string s; void solve() { cin >> n >> s; for (long long i = 1; i <= (n); ++i) cin >> pos[i]; s = '#' + s; long long rst = 1000000000000000007LL; for (long long i = 1; i <= (n - 1); ++i) { if (s[i] == 'R' && s[i + 1] == 'L') rst =...
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()) a = list(input()) b = list(map(int,input().split())) k = 0 x = 0 c = [] d = [] e = [] for i in range(len(a)-1): if a[i] == "R" and a[i+1] == "L": k = 1 break if k == 0: print(-1) else: for i in range(len(a)-1): if a[i] == "R" and a[i+1] == "L": e.append(b...
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()) a = input() arr = list(map(int,input().split())) arr2=[] for i in range(0,n-1): if a[i]=='R' and a[i+1]=='L': arr2.append(arr[i+1]-arr[i]) if arr2 ==[] :print(-1) else :print(min(arr2)//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; import java.util.StringTokenizer; import java.io.PrintWriter; public class A { public static void main(String[]args)throws IOException { FastReader sc = new FastReader(); PrintWriter out = new PrintWriter(System.out)...
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()) moves = input() pos = list(map(int, input().split())) j=0 time = [] for i in range(n-1): if moves[i] is 'R' and moves[i+1] is 'L': time.append(int((-pos[i]+pos[i+1])/2)) j=j+1 if j is 0: time.append(-1) print(min(time[:]))
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()) y=raw_input() N=map(int,raw_input().split()) x=10**9 if 'RL' not in y: print -1 else: for i in range(n-1): if y[i]=='R' and y[i+1]=='L': if x>(N[i+1]-N[i])/2: x=(N[i+1]-N[i])/2 print x
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 acm { public static void main(String[] args){ Scanner in=new Scanner(System.in); int n =in.nextInt(); if(n==1) { System.out.println(-1); System.exit(0); } long nums[]=new long [n],sol=-1; String x = in.next(); for(int i=0;i<n;i++) nums[i]=in.nextLong(); 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> template <typename element_type> std::vector<element_type> read_vector(int size); using namespace std; int main() { int particles; string direction; while (cin >> particles >> direction) { vector<int> start = read_vector<int>(particles); int best = -1; for (int i = 1; i < part...
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 DIV363A { BufferedReader in; PrintWriter ob; StringTokenizer st; public static void main(String[] args) throws IOException { new DIV363A().run(); } void run() throws IOException { //in=new BufferedReader(new FilReader("input.txt")); in=new BufferedReader(ne...
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; /** * Created by ThanhKM on 13/09/16. */ public class A_Launch_of_Collider { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[] dir = sc.next().toCharArray(); int[] pos = new int[n]; for (...
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.*; //267630EY public class Main699A { static PrintWriter out=new PrintWriter(System.out); public static void main(String[] args) throws IOException { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String s=sc.next(); int[] a=sc.nextIntArray(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
n = int(raw_input()) s = raw_input().strip() a = map(int, raw_input().split()) mind = 10**9+1 for i in range(n-1): if s[i:i+2] != "RL": continue d = a[i+1] - a[i] mind = min(mind, d) print -1 if mind == 10**9+1 else mind / 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
N = input() S = raw_input() A = map(int, raw_input().split(" ")) r = 10**9+1 for i in range(1, N): if S[i-1] == "R" and S[i] == "L": r = min(r, A[i] - A[i-1]) # print r print r/2 if r < 10**9+1 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
n = int(input()) dir = input() pos = list(map(int, input().split(" "))) c = 1000000000 count = 0 if "R" not in dir: print(-1) elif "L" not in dir: print(-1) else: for i in range(n-1): if dir[i]=="R" and dir[i+1]=="L": x = (pos[i+1]-pos[i])//2 count+=1 if x<c: c=x else: pass else: pass 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(raw_input()) s = raw_input() c = raw_input().split(" ") i =0 flag = True mini = 1234569967657 while(i<len(s)-1): if(s[i] == 'R' and s[i+1] == 'L'): mini = min(mini,int(c[i+1])-int(c[i])) flag = False i += 1; if(flag): print (-1) else: print (int((mini+1)/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.*; public class LaunchOfCollider { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String s = in.next(); int min = Integer.MAX_VALUE; int lastRight = -1; for (int i = 0; i < n; i++) { if (s.charAt(i) == 'R') ...
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 = input() s = raw_input() x = [int(i) for i in raw_input().split(' ')] r=[] l=[] for i in range(n): if s[i]=="R": r.append(x[i]) else: l.append(x[i]) r=sorted(r) l=sorted(l) a = 10e10 li=0 ri=0 R = len(r) L = len(l) while li < L and ri< R: rv= r[ri] lv=...
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.InputMismatchException; public class BallsGame { private static InputReader in = new InputReader(System.in); private static OutputWriter out = new OutputWriter(System.out); private static void solve() throws Exception { int n = in.readInt(); String symbo...
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()) ds = input() xs = list(map(int, input().split())) cs = [i for i in range(len(ds) - 1) if ds[i:i+2] == "RL"] if len(cs) == 0: print(-1) exit() print(min((xs[c+1] - xs[c]) // 2 for c in cs))
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; public class LaunchOfCollider { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner Scan = new Scanner(System.in); int n = Scan.nextInt(); String word = Scan.next(); long min = (long)Math.pow(10, 14); long[] distances = ...
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 test{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String s=sc.next(); Stack<Integer> stck=new Stack<Integer>(); int min=Integer.MAX_VALUE; int[] a=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
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
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() a=list(map(int,input().split())) ans=[a[i+1]-a[i] for i in range(n-1) if s[i]=='R' and s[i+1]=='L'] if ans: print(min(ans)//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.Scanner; public class Problem5 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = Integer.parseInt(input.nextLine()); String[] directions = input.nextLine().split(""); int[] coors = new int[n]; coors[0] = input.nextInt(); int count = 0; ...
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.math.*; public final class Solution { public static void main(String[] args) { Reader input = new Reader(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int n = input.nextInt(); char[] s = input.next(...
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> int main(void) { int n; scanf("%i", &n); char dirs[n + 1]; int pars[n]; scanf("%s", dirs); for (int i = 0; i < n; i++) { scanf("%i", &pars[i]); } unsigned long int moment = 1000000000000000; int flag = 0; for (int i = 0; i < n - 1; i++) { if (dirs[i] == 'R' && dirs[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.*; import java.io.*; public class Collider { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); in.nextLine(); String s = in.nextLine(); ArrayList<Integer> a = new ArrayList<Integer>(); int[] array = new int[n]; for(int i=0;i<s.length...
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 sys f = sys.stdin num_asteroids = int(f.readline()) dirs = list(f.readline().strip()) positions = [int(pos) for pos in f.readline().split()] best_right = None best_dist = sys.maxint is_valid = False for i in xrange(num_asteroids): if dirs[i] == "R": best_right = positions[i] else: if...
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=input() s=list(raw_input()) a=map(int,raw_input().split()) h=1000000001 for i in range(n-1): if((s[i]=='R')and(s[i+1]=='L')): h=min(h,a[i+1]-a[i]) print [h/2,-1][h==1000000001]
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
#BISMILLAH # ITS NOT OVER WHEN YOU FAIL # ITS OVER WHEN YOU QUIT import math n = input() s = input() l = list(map(int, input().strip().split())) lx = [] mini = math.inf active = False for char, value in zip(s, l): lx.append((char, value)) for i in range(0, len(lx)-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.*; import java.io.*; public class MyClass { public static void main(String args[]) { try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String s = br.readLine(); String str[]...
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
a=int(input()) direct=input() l=list(map(int,input().split())) t=-1 for i in range(a-1): if direct[i]=='R' and direct[i+1]=='L': t=min(t,l[i+1]-l[i]) if t!=-1 else l[i+1]-l[i] print(t//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 python #-*-coding:utf-8 -*- n=int(input())-1 D=input() C=tuple(map(int,input().split())) m=INF=0x7fffffff 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
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
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<unsigned long long> x, d; int main() { unsigned long long n, l = 200001, r = 200001, tmp; string s; cin >> n >> s; for (long long i = n - 1; i >= 0; i--) { if (s[i] == 'L') { l = i; break; } } for (unsigned long long i = 0; i < n; 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.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class pricles { private BufferedReader br; private StringTokenizer st; public pricles() { br = new BufferedReader(new InputStreamReader(System.in)); } pub...
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
/** * * @author Abhishek Shankhadhar */ import java.io.*; import java.util.*; public class CFA { InputStream obj; PrintWriter out; String check = ""; //Solution !! void solution() { int n=inti(); String s=stri(); int arr[]=arri(n); long ans=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.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in Actual solution is at the top * * @author https://codeforces.com/ */ public class Main { public static void main(String[] args) { Input...
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.*; public class Main implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); void init() throws FileNotFoundException { try { in = new BufferedReader(new FileReader("input.txt")); out =...
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()) a=[*enumerate(input())] b=[*map(int,input().split())] a.sort(key=lambda x:b[x[0]]) k=0 r=l=-1 while k<n: if a[k][1]=='R':l=k elif l>-1: c=-(b[a[l][0]]-b[a[k][0]])//2 r=[min(r,c),c][r<0] k+=1 print(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(input()) ##a = list(map(int, input().split())) ##print(" ".join(map(str, res))) n = int(input()) s = input() x = list(map(int, input().split())) res = 1000000007 for i in range(len(s)-1): a = s[i] b = s[i+1] if a == 'R' and b == 'L': res = min(res, int((x[i+1]-x[i])/2)) if res >= 100000...
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.*; import java.lang.Math.*; public class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int arr[]=new int[n]; String s=sc.next(); for(int i=0;i<n;i++) arr[i]=sc.nextInt(); int min=1000000002; for(int i=0;i<n-1;i++) { if(s.charAt(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
n = int(input()) s = input() a = list(map(int, input().split())) ans = 10000000000000 for i in range(n - 1): if s[i] == 'R' and s[i + 1] == 'L': ans = min(ans, (a[i + 1] - a[i]) // 2) if ans == 10000000000000: 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
import java.util.Scanner; public class Launch { public static void main(String[] args){ int n; Scanner sc=new Scanner(System.in); n=sc.nextInt(); String dir=sc.next(); //System.out.println(dir); long a[]=new long[n+1]; for(int i=1;i<=n;i++){ a[i]=sc.nextLong(); } System.out.println(); int l=-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(raw_input()) direction = raw_input() pos = map(int,raw_input().split()) collisions = [] distance = [] #gonna need RL to have collision --> <--- if "RL" not in direction: print "-1" else: for i in xrange(n-1): if direction[i] == 'R' and direction[i+1] == 'L': collisions.append(i) ...
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; cin >> n; string s; cin >> s; vector<long long int> nums(n); for (int i = 0; i < (int)(n); ++i) { cin >> nums[i]; } long long int result = -1; for (int i = 0; i < s.size() - 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
n = int (input()) dir = input() nums = list(map(int, input().split())) diff =ans=c= 0 for i in range(len(dir) -1): if dir[i] == 'R' and dir[i+1] == 'L': diff = nums[i+1] - nums[i] if c ==0 or c> (diff/2) : c = (diff/2) if c == 0: print(-1) else: print(int (c))
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() { string dir; int a[2]; int n; cin >> n; cin >> dir; int prev, cur; long min = LONG_MAX; bool found = false; cin >> prev; for (int i = 1; i < n; ++i) { cin >> cur; if (dir[i] == 'L' && dir[i - 1] == 'R') { if ((cur - prev) / 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
#!/usr/bin/env python import os import re import sys from bisect import bisect, bisect_left, insort, insort_left from collections import Counter, defaultdict, deque from copy import deepcopy from decimal import Decimal from fractions import gcd from io import BytesIO, IOBase from itertools import ( accumulate, comb...
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() { int n; cin >> n; long long a[n], x1, mi = 10000000000, k = 0; char c[n]; for (int i = 0; i < n; i++) cin >> c[i]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { if (c[i] == 'L' && k == 1) { if (a[i] - x1 < mi) 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()) s=input() a=list(map(int,input().split())) m=100000000000000 found=0 for i in range(n-1): if s[i]=='R' and s[i+1]=='L': m=min(m,(a[i+1]-a[i])) found=1 print([-1,m//2][found])
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()) a=input() b=[int(i) for i in input().split()] p=[] for i in range(n-1): if a[i:i+2]=='RL': p.append(b[i+1]-b[i]) if len(p)!=0: print(min(p)//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.*; import java.lang.*; import java.io.*; public class S5 { public static void main(String[] args) { final Comparator<Double[]> arrayComparator = new Comparator<Double[]>() { @Override public int compare(Double[] o1, Double[] o2) { return o1[0].compareTo(o2[0]);...
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 = input() s = raw_input() x = map(int, raw_input().split()) ans = 10 ** 10 for i in range(len(x)): if s[i] == 'R' and i < len(x) - 1: if s[i+1] == 'L': d = (x[i+1] - x[i]) / 2 ans = min(ans, d) elif s[i] == 'L' and i > 0: if s[i-1] == 'R': d = (x[i] - x[i-...
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
def main(): n = int(raw_input()) lett = list(raw_input()) dig = raw_input().split(" ") for i in range(len(dig)): dig[i] = int(dig[i]) # n = 4 # lett = ['R', 'L', 'R', 'L'] # dig = [2, 4, 6, 10] m = 10 ** 9 + 1 changed = False for i in range(0, n - 1): if lett[i...
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()) moves = input() arr = list(map(int, input().split())) result = arr[-1] for i in range(n): if i == n-1: pass elif moves[i] == 'R' and moves[i+1] == 'L': res = (arr[i+1] - arr[i])//2 if res < result: result = res if result == arr[-1]: print(-1) else: print(...
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
from sys import stdin import math T = int(stdin.readline()) numbers = [['L',0] for i in range (T)] chars = stdin.readline() chars = chars.strip() nums = stdin.readline() nums = nums.strip() nums = nums.split() l = len(chars) mindist = math.inf prevR = -1 for i in range(l): numbers[i][0] = chars[i] numbers[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
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class A363_LaunchOfCollider { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer....
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; string rl; cin >> rl; vector<int> A(n, 0); for (int i = 0; i < n; i++) cin >> A[i]; int diff = 2147483647; int t; for (int i = 0; i < n - 1; i++) if (rl[i] == 'R' && rl[i + 1] == 'L') { t = (A[i + 1] - A[i]) / 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> using namespace std; const int MAXN = 1e6 + 22; const int INF = 1e9 + 2; long long n, ans = INF, a[MAXN]; string str; long long ed(long long x, long long y) { if (x > y) return x - y; else return y - x; } int main() { cin >> n; cin >> str; for (long long i = 0; i < n; i++) cin...
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()) s = raw_input() li = map(int, raw_input().split()) ans = -1 l = -1 r = -1 for i in xrange(n): if s[i] == 'R': r = i if s[i] == 'L': l = i if l != -1 and r != -1 and r < l: if ans == -1: ans = (li[l] - li[r])/2 ans = min(ans, (li[l] - li[r])/2) prin...
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
//package credit; import java.io.*; import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class sas { static boolean v[]; static int ans[]; int size[]; static int count=0; 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
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i, y, p = 1000000000; cin >> n; long long int a[n]; int flag = 0; char c[n]; for (i = 0; i < n; i++) { cin >> c[i]; } for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 0; i < n; i++) { if (c[i] == 'R' && c[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=input() s=raw_input() a=map(int,raw_input().split()) t=1<<63 for i in range(1,n): if 'R'==s[i-1] and 'L'==s[i]: t=min(t,a[i]-a[i-1]) print t/2 if t<1<<63 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 n; string s; int A[200555]; int rs = 2e9 + 69; void read() { cin >> n; cin >> s; for (int i = 1; i <= n; ++i) { cin >> A[i]; } for (int i = 0; i < s.size() - 1; ++i) { if (s[i] == 'R' && s[i + 1] == 'L') { rs = min(rs, (A[i + 2] - A[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> inline bool RC() { char cr; while ((cr = getchar()) != 'L' && cr != 'R') ; return cr == 'R'; } bool tr[200005]; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) tr[i] = RC(); int last_right = -1; int ans = 1000000007; for (int i = 1; i <= n; i++) { 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
import sys def start(s, lst): minimum = sys.maxsize for i in range(len(lst)): if i + 1 < len(lst): if s[i + 1] == 'L' and s[i] == 'R': if lst[i + 1] - lst[i] < minimum: minimum = lst[i + 1] - lst[i] if minimum == sys.maxsize: return -1 re...
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().rstrip() a = list(map(int, input().split())) l, r = [], [] for i in range(n): if s[i] == 'R': r.append(a[i]) else: l.append(a[i]) i = j = 0 ans = 10 ** 10 while i < len(r) and j < len(l): if r[i] < l[j]: ans = min(ans, l[j] - r[i]) i += 1 else...
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())) if "L" not in s: print(-1) exit(0) if "R" not in s: print(-1) exit(0) ans = [] f = 0 for i in range(n): if s[i] == "R": right = a[i] f = 1 elif f and s[i] == "L": left = a[i] f = 0 ans.appen...
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; long long int a[200007], b[200007]; int main() { ios ::sync_with_stdio(false); cin.tie(0); ; long long int n, i, mn = 1e9; string s; cin >> n >> s; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 1; i < n; i++) { if (s[i - 1] == 'R' && s[...
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.BufferedReader; import java.io.InputStreamReader; public class A { public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(bf.readLine()); String l[]; char dir[] = bf.readLine().toCharArray(); ...
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 = input() s = raw_input() X = map(int, raw_input().split()) ans = 2 * 10 ** 9 for i in xrange(n - 1): if s[i] == 'R' and s[i + 1] == 'L': ans = min(ans, (X[i + 1] - X[i])/2) if ans == 2 * 10 ** 9: ans = -1 print ans if __name__ ...
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() l = list(map(int, input().split())) ans = [l[i+1]-l[i] for i in range(n-1) if s[i] == "R" and s[i+1] == "L"] if ans: print(min(ans)//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
#include <bits/stdc++.h> using namespace std; const int maxn = 0x3f3f3f3f; int dir[200000 + 100]; int pos[200000 + 100]; int main() { int n; char ch; memset(dir, 0, sizeof(dir)); memset(pos, 0, sizeof(pos)); scanf("%d\n", &n); for (int i = 0; i < n; i++) { scanf("%c", &ch); if (ch == 'L') dir[...
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
from sys import stdin, stdout n = int(stdin.readline()) route = stdin.readline().rstrip() coordinates = list(map(int, stdin.readline().split())) ans = float('inf') coordinate = -1 for i in range(n): if route[i] == 'R': coordinate = coordinates[i] elif coordinate != -1 and route[i] == 'L': 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
try: _ = input() s = input() a = list(map(int, input().split())) ans = float('inf') for i in range(0, len(a)-1): if s[i] == 'R' and s[i+1] == 'L': ans = min(ans, (a[i+1] - a[i])//2) if ans == float('inf'): print(-1) exit(0) print(ans) except: pass
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().strip()) direction = raw_input().strip() x = map(int, raw_input().strip().split(' ')) a = sorted([(x[i], direction[i]) for i in range(n)]) min_d = -1 for i in range(n-1): if a[i][1] == 'R' and a[i+1][1] == 'L': new_d = abs(a[i][0] - a[i+1][0])/2 if min_d < 0 or min_d > new_d: min_d = new_d...
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
num = int(input()) s = input() arr = list(map(int, input().split())) collision = False ans = float("inf") for i in range(1, num): if s[i-1] == "R" and s[i] == "L": ans = min(ans, (arr[i]-arr[i-1])//2) collision = True if not collision: 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
if __name__ == '__main__': n = int(input()) d = list(str(input())) line = list(map(int, input().split())) value = 1000000001 for i in range(n - 1): if d[i] == 'R' and d[i + 1] == 'L': value = min(value, line[i + 1] - line[i]) if value > 1000000000: print(-1) else:...
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
class particle: x=0 o='' n=int(input()) st=input() lt=[] for i in range(len(st)): a=particle() a.o=st[i] lt.append(a) st=input() tmp=st.split(' ') dir={'R':1,'L':-1} for i in range(len(tmp)): lt[i].x=int(tmp[i]) minn=-1 for i in range(len(lt)-1): if dir[lt[i].o]<=dir[lt[i+1].o]: ...
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
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 itertools import re def get_row_input(): return raw_input() + '\n' + raw_input() + '\n' + raw_input() def parse(s): r1, r2, r3 = s.split('\n') return int(r1), r2, map(int, r3.split(' ')) def solve(n, vec, points): if not re.search('RL', vec): return -1 distances = [] for i in x...
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.BufferedOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; import java.util.Vector; public class Codechef { public sta...
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.math.*; import java.io.*; public class solution { public static void merge(int arr[], int l, int m, int r) { // Find sizes of two subarrays to be merged int n1 = m - l + 1; int n2 = r - m; /* Create temp arrays */ int L[] = new int[n1]; ...
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() L=[int(i) for i in input().split()] low=[] for i in range(n-1): if s[i]+s[i+1]=="RL": low.append((L[i+1]-L[i])//2) x=[str(i) for i in low] x="".join(x) print(min(low) if x!="" 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
n = int(input()) d = input() x = list(map(int, input().split())) result = -1 for i in range(1, n): if d[i-1] != 'R' or d[i] != 'L': continue if result == -1: result = (x[i]-x[i-1])//2 else: result = min(result, (x[i]-x[i-1])//2) print(result)
PYTHON3