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.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.StringTokenizer; public class Main { ...
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 A699 { public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); String str = in.next(); int[] arr = new int[n]; for (int i = 0 ; i < n ; i++){ arr[i] = in.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
import java.util.Scanner; public class LaunchOfCollider { public static void main(String... args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); String firstLine = scanner.next(); scanner.nextLine(); String secLine = scanner.nextLine(); String...
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.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class test { public static void main(String[] args) throws IOException { Scanner scan =...
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.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String arg[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); int n = Int...
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, cou = -1; long long int sum = 10000000000; cin >> n; long long int array[n]; char array1[n]; for (int i = 0; i < n; i++) cin >> array1[i]; for (int i = 0; i < n; i++) cin >> array[i]; for (int i = 0; i < n - 1; i++) { if (array1[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()) direction = input() array = list(map(int, input().split())) count = direction.count('RL') if count == 0: print(-1) exit(0) else: first = direction.index('RL') dist = array[first + 1] - array[first] while count > 1: first += direction[first + 1:].index('RL') + 1 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
import java.util.*; public class A699 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); String directions = scan.next(); int min = Integer.MAX_VALUE; int right = -1; boolean found = false; for (int i = 0; i < n; i++) { int cur = scan.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
def pro(): n = int(input()) s = input() a = list(map(int, input().split())) cnt = 1000000001 for i in range(n-1): if s[i]+s[i+1] == 'RL': cnt = min(cnt, (a[i+1] - a[i]) // 2) if cnt == 1000000001: print(-1) else: print(cnt) pro()
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 main { public static void main(String args[]){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); sc.nextLine(); String str=sc.nextLine(); int pos[]=new int[n]; for(int i=0;i<n;i++){ pos[i]=sc.nextInt(); } int ans=Integer.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
#include <bits/stdc++.h> using namespace std; long long INV2 = 500000004; long long INV6 = 166666668; long long power(long long a, long long b, long long c) { long long x = 1, y = a; while (b > 0) { if (b & 1) x = (x * y) % c; y = (y * y) % c; b /= 2; } return x % c; } int dx[] = {0, -1, 0, 1}; 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; long long h = 1e9; string st; cin >> st; long long arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } for (int j = 0; j < n - 1; j++) { if (st[j] == 'R' && st[j + 1] == 'L') { h = min(h, (arr[j + 1] - arr[j])...
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() cc = [int(x) for x in raw_input().split()] curc = None curi = -1 mn = 1e10 i = 0 for c in s: if c == 'R': curi = i if curi != -1 and c == 'L': mn = min(mn, (cc[i] - cc[curi]) / 2) i += 1 if mn == 1e10: print -1 else: print mn
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 tot, Link[101000]; struct node { int v, next; } edge[201000]; void add(int x, int y) { tot++; edge[tot].v = y; edge[tot].next = Link[x]; Link[x] = tot; } char st[210000]; int a[210000]; int main() { int n; scanf("%d", &n); scanf(" %s", st + 1); int 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
n = int(input()) dir = input() seq = list(map(int, input().split())) min = 1000000000 for i in range(1, n): if dir[i-1] == "R" and dir[i] == "L": if (seq[i] - seq[i-1])/2 < min: min = (seq[i] - seq[i-1])/2 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()) Ds = [x for x in input()] Cs = [int(x) for x in input().split()] Ans = int(1e9) for i in range(N-1): if Ds[i] == 'R' and Ds[i+1] == 'L': Ans = min(Ans,(Cs[i+1] - Cs[i]) // 2) if Ans == int(1e9): 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()) r = input() h = list(map(int,input().split())) l = [] for i in range(n-1): if r[i] == 'R' and r[i+1]=='L': l.append(abs((h[i] - h[i+1]))/2) if l == []: print(-1) else: print(int(min(l)))
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 = raw_input().strip() x = [int(xi) for xi in raw_input().split(" ")] nf = True i = 0 ans = -1 while i < (n-1): if s[i] == 'R' and s[i+1] == 'L': d = (x[i+1]-x[i])/2 if ans == -1: ans = d elif d < ans: ans = d nf = False i += 1 if nf: print -1 exit() 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
n = int( input() ) d = str( input() ) p = input().split() ans = -1 for i in range( 1 , n ): if d[ i - 1 ] == 'R' and d[ i ] == 'L': tans = ( int( p[ i ] ) - int( p[ i - 1 ] ) ) // 2 if ans == -1 or tans < ans: ans = tans 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 int n, d; string s; cin >> n >> s; vector<long long int> v; long long int a[n]; for (long long int i = 0; i < n; ++i) cin >> a[i]; for (long long int i = 0; i < n - 1; ++i) { d = a[i + 1] - a[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()) d = input() x = list(map(int, input().split())) inf = 10**10 def solve(): if n == 1: return -1 ret = inf for i in range(1, n): if d[i - 1] == 'R' and d[i] == 'L': ret = min(ret, (x[i] - x[i - 1]) // 2) if ret == inf: return -1 return ret print(sol...
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.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; /** * * @author Ahmed */ public class Test { /** * @param args the command line arguments * @throws java.io....
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> R, L; vector<long>::iterator Rit, Lit; long a[long(2e5 + 100)]; int main() { long n; string s; scanf("%ld", &n); cin >> s; long res = 999999999; for (long i = 0; i < s.length(); ++i) if (s[i] == 'R') R.push_back(i + 1); else L.pu...
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() c = list(map(int,input().split())) flag = False flag1 = False r, l = 0, 0 arr = [] for i in range(n): if s[i] == 'R': flag = True r = c[i] elif s[i] == 'L' and flag: flag1 = True l = c[i] arr.append(l-r) if len(arr) == 0: print(-1) exi...
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, d, x, v = int(input()), input(), list(map(int, input().split())), -1 for i in range(1, n): if d[i - 1] == 'R' and d[i] == 'L': c = (x[i] - x[i - 1]) // 2 if v == -1 or c < v: v = c print(v)
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()) str = raw_input() dis = map(int, raw_input().split(" ")) max = 10000000000 dist = max posL = -1 posR = -1 for i in range(n): if str[i] == 'L': posL = dis[i] if posR != -1 and posL-posR<dist: dist = posL-posR elif str[i] == 'R': posR = dis[i] if dist == max: dist = -1 else: di...
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
hat = int(input()) moves = list(input()) pos = [int(x) for x in input().split()] ans = [] for i in range(len(moves)): if moves[i] == "R" and i != len(moves)-1: if moves[i+1] == "L": ans.append(int(abs(pos[i]-pos[i+1])/2)) if len(ans) == 0: print(-1) else: 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
n = int(input()) s = input() x = list(map(int,input().split())) ls = [] l = [] lx = [] if 'RL' in s: for i in range(1,n): if s[i - 1] == 'R' and s[i] == 'L': x1 = x[i - 1] x2 = x[i] ls.append(x2 - x1) l.append(x2 + x1) lx.append(x2) res = lx[ls.index(min(ls))] - (l[ls.index(min(ls))] / 2) print(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 = input() s = raw_input() l = raw_input().split() l1 = [x for x in range(len(s)-1) if s[x]=='R' and s[x+1]=='L'] d = [int(l[i+1])-int(l[i])for i in l1] if len(d):print min(d)/2 else:print -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.*; import java.util.*; /** * Created by АлСксСй on 07/20/2016. */ public class IDontKnow { public static void main(String [] args){ InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWrite...
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())) a = [] if s.count('RL') == 0: print(-1) else: for i in range(n - 1): if s[i] == 'R' and s[i + 1] == 'L': a.append(x[i + 1] - x[i]) print(min(a) // 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.util.*; import java.lang.*; public class A { public static void main(String[] args) { // getting the inputs Scanner in = new Scanner(System.in); int n = in.nextInt(); String d = in.next(); int[] p = new int[n]; for(int i = 0; i < n; i++) p[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
#BISMILLAH # ITS NOT OVER WHEN YOU FAIL # ITS OVER WHEN YOU QUIT flag = False mini = 1000000000+7 n = int(input()) s = input() l = list(map(int, input().strip().split())) for i in range(0, n-1): if s[i] == "R" and s[i+1]=="L": flag = True mini = min(mini,int((l[i]+l[i+1])/2)-l[i]) if flag ...
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 Collider { public static void main(String args[]) { Scanner sc= new Scanner(System.in); int n=sc.nextInt(); char dir[]= new char[n]; long pos[]=new long[n]; String s=sc.next();; for(int i=0;i<n;i++) { dir[i]=s.c...
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.*; public class CF699A { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int flag=-1; int min=Integer.MAX_VALUE; int c1=0,c2=0; sc.nextLine(); String s=sc.nextLine(); //System.out.println(s); int 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()) p=list(input()) nop=list(map(int,input().split())) ro=[] for x in range(n-1): if p[x]=="R": if p[x+1]=="L": ro.append(nop[x+1]-nop[x]) else: pass else: pass if ro==list(): print(-1) else: print(min(ro)//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 a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z; char arr[200100], tp; int arr2[200100]; int main() { scanf(" %d", &n); cin >> arr; for (i = 0; i < n; i++) { scanf(" %d", &arr2[i]); } z = INT_MAX; for (i = 0; i < n - 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
#include <bits/stdc++.h> int main() { int n, i, min, x[200000]; scanf("%d", &n); char a[200000]; scanf("%s", a); scanf("%d", &x[0]); min = 1000000001; for (i = 1; i < n; i++) { scanf("%d", &x[i]); if (a[i] == 'L' && a[i - 1] == 'R') { if (x[i] - x[i - 1] < min) min = x[i] - x[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
#include <bits/stdc++.h> using namespace std; long long pos[200000]; int main() { int n; cin >> n; string mvt; cin >> mvt; for (int i = 0; i < n; i++) { cin >> pos[i]; } long long ans = 1e10; for (int i = 1; i < n; i++) { if (mvt[i] == 'L' && mvt[i - 1] == 'R') { ans = min(ans, (pos[i] - p...
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() directions=raw_input() cordinates=[int(cord) for cord in raw_input().split()] t=1000000001 if len(directions)==1: print "{}".format(-1) else: for move in range(len(directions)-1): if directions[move]=='R' and directions[move+1]=='L': t=min(t,(cordinates[move+1]-cordinates[move])/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
def Collision(): n = int(raw_input()) directions = raw_input() coords = raw_input().split() collisions = [] for i in range(n): collisions.append((directions[i],int(coords[i]))) #print collisions min_dist = 0 direction = 'L' for i in range(n): if collisions[i][0] ==...
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.*; public class Main { final static long mod = (long)10e9+7; public static void main(String[] args) { InputReader sc = new InputReader(System.in); PrintWriter pw = new PrintWriter(System.out); Random gen = new Random(); int test = 1;//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
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; long long a[n + 5], ans = 1e18; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1; i++) { if (s[i] == 'R' && s[i + 1] == 'L') ans = min(ans, (a[i + 1] - a[i]) / 2); } if (ans == 1e18) cout...
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(new BufferedReader(new FileReader("input.txt"))); Scanner in = new Scanner(System.in); int n = Integer.parseInt((in.nextLine())); char [] s = in.nextLine().toCharArray(); int [] x = 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
n=int(input()) s=input() arr=[int(x) for x in input().split()] m=1000000007 for i in range(n-1): if(s[i]=='R' and s[i+1]=='L'): m=min((arr[i+1]-arr[i])//2,m) if(m!=1000000007): print(m) 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.io.*; import java.util.*; public class Fast { @SuppressWarnings("unused") public static void main(String args[])throws IOException { Reader ob=new Reader(); Writer out=new Writer(System.out); int n=ob.nI(); String s=ob.n(); int a[]=ob.NIA(n),ans=Integer.M...
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; string s; cin >> n >> s; long long arr[200000], x = 2000000001, c = 0; for (int i = 0; i < n; i++) { cin >> arr[i]; } for (int i = 1; i < n; i++) { if (s[i] == 'L' && s[i - 1] == 'R') { if (x > ((arr[i] - arr[i - 1]) / 2)) x =...
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()) direction = raw_input() firstDirection = direction[0] distance = 100000000000 flag = 1 distanceL = (raw_input().split()) firstObject = int(distanceL[0]) for i in range(1,N): secondObject = int(distanceL[i]) secondDirection = direction[i] if firstDirection=='R' and secondDirection=='L':...
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(raw_input()) string = raw_input() array = map(int, raw_input().split()) ans = 99999999999 for i in xrange(1, n): #print i, string[i-1], string[i] if string[i-1] == 'R' and string [i] == 'L': time = array[i] - array[i-1] ans = min(ans, time / 2) if ans == 99999999999: print -1 els...
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
// "static void main" must be defined in a public class. import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String dir = sc.next(); int[] arr =new int[n]; for(int i =0 ; i< n; i++ ) { a...
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()) r = input() s = [int(i) for i in input().split()] c = 10**9+1 if r.count("RL"): for i in range(n-1): if r[i]=="R" and r[i+1]=="L": c = min(((s[i+1]-s[i])//2),c) print(c) 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 main() { ios_base::sync_with_stdio(false); int n; cin >> n; string s; cin >> s; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = INT_MAX; for (int i = 0; i < n - 1; i++) { if (s[i] == 'R' && s[i + 1] == 'L') { ans = min(...
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> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } int ans = 1e9; for (int i = 1; i < n; ++i) { if (s[i - 1] == 'R' && s[i] == 'L') { ans = min(ans, (a[i] - 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> int mod = (int)1e9 + 7; using namespace std; int main() { int n, i; cin >> n; string d; cin >> d; vector<int> x(n); for (i = 0; i < n; i++) cin >> x[i]; int mi = INT_MAX; for (int i = 0; i < n - 1; i++) { if (d[i] == 'R' && d[i + 1] == 'L') { mi = min(mi, (x[i + 1] - x...
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() arr = map(int, raw_input().strip().split()) ans = float("inf") prev = None for i, j in enumerate(s): if j == 'R': prev = i elif j == 'L' and prev != None: time = abs(arr[prev] - arr[i]) / 2 ans = min(ans, time) if ans != float("inf"): print ans else: print -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()) direction = input() xi = [int(x) for x in input().split(' ')] m = [] for i in range(n-1): if direction[i:i+2] != 'RL': continue m.append(xi[i+1] - xi[i]) if not m: print(-1) else: print(int(min(m)/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
n=int(input()) s=input() v=[int(i) for i in input().split()] i=0 j=0 f=0 mt=1000000001 while(i<n): while(i<n and s[i]!='R'): i=i+1 while(i<n and s[i]=='R'): i=i+1 i=i-1 j=i+1 if(j>=n): break while(j<n and s[j]!='L'): j=j+1 if(s[j]=='L'): f=1 t=(v[j]+v[i])/2-v[i] if(t<mt): mt=t else: break...
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
# coding: utf-8 # In[3]: n = int(input()) s = input() idxs = list(map(int, input().split())) r_flag = -1 l_flag = -1 ans = 10**20 for idx, q in enumerate(s): if q == 'R': r_flag = idxs[idx] else: l_flag = idxs[idx] if r_flag != -1: ans = min(ans, (l_flag - r_flag) // 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 n; long long x[2000005]; int type[2000005]; char str[2000005]; int main() { scanf("%d", &n); scanf("%s", str); for (int i = 0; i < n; i++) scanf("%I64d", &x[i]); for (int i = 0; i < n; i++) if (str[i] == 'L') type[i] = -1; else type[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(input()) m = input() moves = [i for i in m] positions = list(map(int, input().split())) if not 'RL' in m: print(-1) else: mini = positions[-1] - positions[0] for i in range(n-1): if moves[i] == 'R' and moves[i+1] == 'L': mini = min(mini, positions[i+1] - positions[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
#include <bits/stdc++.h> const int N = 200500; using namespace std; struct arr { long long as; } a[N]; int main() { long long b[N]; char c[N]; int n; cin >> n; cin >> c; for (int i = 0; i < n; i++) { cin >> a[i].as; } int j = 0; for (int i = 0; i < n; i++) { if (c[i] == 'R' && c[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
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; string s; cin >> s; int arr[n]; int c, z = -1; 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') {...
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; import java.util.ArrayList; public class a { public static void main(String[] args) { new a(); } a(){ int N = nextInt(); char[] charr = nextChara(); int[] arr = new int[N]; int differenceHalf = -1; for(int i = 0; i < N; i++){ arr[...
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 Runnable { public static void main(String[] args) { int count; int time = -1; String directions = ""; String[] distances; int rIndex = -1; int lIndex = -1; Scanner reader = new Scanner(System.in); count = reader.nextInt(); reader.nextLine(); directions = rea...
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 math sb= raw_input() s= raw_input().strip() num= raw_input().strip().split(" ") num= map(int, num) lens= len(s) ans= -1 for x in xrange(lens- 1): if s[x]== 'R' and s[x+1]== 'L': t= abs(num[x]- num[x+1])/2 if ans== -1: ans= t elif ans> t: ans= t 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
#include <bits/stdc++.h> using namespace std; int main() { int n, mn = INT_MAX; string s; cin >> n >> s; int arr[n]; 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') { mn = min((arr[i + 1] - arr[i]) / 2, mn); } } if (mn == 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
n = int(input()) s = input() x = list(map(int, input().split())) mn = 10000000000 for i in range(n-1): if s[i] == 'R' and s[i+1] == 'L': if x[i+1] - x[i] < mn: mn = x[i+1] - x[i] if mn == 10000000000: print(-1) else: print(mn//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.util.*; public class main { public static void main(String args[]) throws Exception { Scanner in = new Scanner(System.in); int n = in.nextInt(); String lr = in.next(); int i; long g=-1; int k=-1; int[]a=new int[n]; for(i=0;i<n;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(raw_input()) a = raw_input() b = map(int, raw_input().split()) ans = 12345678901 for i in xrange(n-1): if a[i] == 'R' and a[i+1] == 'L': ans = min(ans, (b[i+1]-b[i])/2) if ans == 12345678901: 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
#include <bits/stdc++.h> using namespace std; int main() { int n = 0, ans = 1e9 + 1; string s; cin >> n >> s; vector<double> x(n); for (int i = 0; i < n; i++) { cin >> x[i]; } for (int i = 0; i < n; i++) { if (i < n + 1 && s[i] == 'R' && s[i + 1] == 'L' && (x[i + 1] - x[i]) / 2 < 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
#include <bits/stdc++.h> const int N = 200005; int n, pos[N], l[N], r[N]; char d[N]; using namespace std; int main() { scanf("%d", &n); scanf("\n%s", d + 1); d[0] = d[n + 1] = '%'; int i; for (i = 1; i <= n; i++) scanf("%d", &pos[i]); for (i = 1; i <= n; i++) if (d[i - 1] == 'R') l[i] = 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
no=int(input()) balls=input() places = list(map(int,input().split())) if not('R' in balls and 'L' in balls) or balls.find('R') == no-1: print(-1) else: tot =[] start = balls.find('R') expl = 0 - places[start] need = True for i in range(start+1,no): if need==True: if balls[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()) direction = raw_input() dirs = [] for i in range(0,n): dirs.append(direction[i]) starts = map(int, raw_input().split()) ans = 10**10 for k in range(0,n-1): if dirs[k]=="R" and dirs[k+1]=="L": ans = min(ans, abs(starts[k]-starts[k+1])/2) if ans<10**10: print ans else: print -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
#codeforces contest n 669 #a - a launch of collider np = int(raw_input()) mov = raw_input() posi = map(int, raw_input().split()) colisions = [] for i in range(np - 1): if mov[i] == "R" and mov[i + 1] == "L": colisions.append((i, i+1)) if colisions == []: print -1 else: k, j = colisions[0][0], c...
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 sys n = int(sys.stdin.readline().split()[0]) str = sys.stdin.readline().split()[0] x = [int(y) for y in sys.stdin.readline().split()] res = 1000000000 for i in range(1, n): if str[i] == 'L' and str[i - 1] == 'R': res = min(res, (x[i] - x[i - 1]) / 2) if res == 1000000000: print -1 else: print res
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() p=[int(z) for z in input().split()] if n==1: print(-1) else: mi=float("Inf") for i in range(1,n): if s[i]=="L" and s[i-1]=="R": mi=min(mi,(p[i]-p[i-1])//2) if mi==float("Inf"): 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
#include <bits/stdc++.h> int main() { long long n, i, j, k, l = 10000000000, d = 0; scanf("%I64d", &n); char s[n + 1]; getchar(); scanf("%s", s); long long a[n]; for (i = 0; i < n; i++) { scanf("%I64d", &a[i]); } for (i = 0; i < n; i++) { if (s[i] == 'R' && s[i + 1] == 'L') { d = 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
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n; cin >> n; string a; cin >> a; long long m[n]; for (long long &x : m) cin >> x; long long min = INT_MAX; long long flag = 0; for (long long i = 0; i < a.length() - 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
n=int(input()) d=raw_input() s=map(int,raw_input().split()) ans=1000000000 found=False for i in xrange(n-1) : if d[i]=='R' and d[i+1]=='L' : ans=min(ans,(s[i+1]-s[i])/2) found=True if found : print ans else : print -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()) a=input() b=input() b=b.split() x=0-1 for i in range(N-1): if a[i]=='R' and a[i+1]=='L': s=(int(b[i+1])-int(b[i]))//2 if x==0-1: x=s else: x=min(x, s) print(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
#include <bits/stdc++.h> using namespace std; void fast() { std::ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { fast(); long long n; cin >> n; string s; cin >> s; vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } bool ok = false; multiset<int> m; for (...
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 = list(input()) coord = input().strip().split(' ') coord = [int(c) for c in coord] flag = 0 tmin = 10**9 for i in range(n-1): if dir[i]=='R' and dir[i+1]=='L': flag = 1 tmin = min(tmin, (coord[i+1]-coord[i])//2) if flag: print(tmin) 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 main() { string s; int i, flag = 0, n, arr[300000]; cin >> n; cin >> s; for (i = 0; i < n; i++) { cin >> arr[i]; } for (i = 0; i < s.size() - 1; i++) { if (s[i] == 'R' && s[i + 1] == 'L') { flag = 1; break; } } int minim = INFIN...
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; /** * Created by mitcc on 2016/6/15. */ public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String s = in.next(); int[] a = new int[n]; for (int i = 0; i < n; ++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 main() { int n, i, cnt = 0, flag, Min; char a[200001]; int b[200001]; int c[200001]; while (~scanf("%d", &n)) { flag = 0; Min = 0x3f3f3f3f; memset(a, 0, sizeof(a)); memset(b, 0, sizeof(b)); memset(c, 0, sizeof(c)); scanf("%s", a); f...
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().strip()) l = input().strip() ll = list(map(int,input().split())) ll1 = [] for i in range(n-1): if l[i] == 'R' and l[i+1] == 'L': ll1.append(abs(ll[i] - ll[i+1]) // 2) print(min(ll1) if len(ll1) != 0 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()) st = input() lst = list(map(int, input().split())) minn = float("INF") yes = False for i in range(n-1): if st[i] == "R" and st[i+1] == "L": yes = True minn = min(minn, (lst[i+1] - lst[i])//2) if not yes: print(-1) else: print(minn+1+1-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.util.*; public class Launch_of_collider { public static void main(String args[]){ Scanner s= new Scanner(System.in); int n=s.nextInt(); s.nextLine(); String str=s.nextLine(); int arr[]= new int[n]; for(int i=0;i<n;i++){ if(str.charAt(i)=='L') arr[i]=s.nextInt(); else arr[i]=(-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
#include <bits/stdc++.h> inline int max(register int a, register int b) { return a > b ? a : b; } inline int min(register int a, register int b) { return a < b ? a : b; } int F() { register int aa, bb, ch; while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-') ; ch == '-' ? aa = bb = 0 : (aa = ch - '0', ...
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())) ans = float('inf') test = 0 for i in range(1, n): if s[i-1]=='R' and s[i]=='L': test = 1 ans = min(ans, (a[i]-a[i-1])//2) if test: 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
n = int(input()) direc = input() coord = [int(x) for x in input().split()] prev = "" minsf = 1e10 for i, d in enumerate(direc): if prev == "R" and d == "L": minsf = min(minsf, coord[i] - coord[i-1]) prev = d print(-1 if minsf == 1e10 else minsf // 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.util.Map; import java.util.StringTokenizer; public class SolutionA { private final static String FILENAME; private final static String PATH; static { FILENAME = ""; if (!FILENAME.isEmpty()) { PATH = System.getProperty("user.home") + "/contests/" + ...
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 = [int(i) for i in input().split()] minValue = -1 for i in range(n - 1): if s[i] == 'R' and s[i + 1] == 'L': r = (x[i + 1] - x[i]) // 2 if minValue == -1 or r < minValue: minValue = r print(minValue)
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
amount = int(input()) direction = input() coord = [int(i) for i in input().split()] modulus1 = list() modulus2 = list() for i in range(amount-1): modulus1.append(coord[i+1] - coord[i]) for i in range(amount): if direction[i] == "L": coord[i] -= 1 else: coord[i] += 1 for i in range(amount-1): modulus2.append(coo...
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 Solution699A { private static FastScanner in; private static PrintWriter out; public static void main(String[] args) { in = new FastScanner(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); 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(input()) di = [i for i in input()] lst = list(map(int, input().split())) i = 0 res = [] while i < n : if di[i] == 'R': f = i i+=1 if i == n: break while di[i] == 'R': f = i i+=1 if i == n: break if i == n...
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.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.StringTokenizer; public class Main { public static void main(String[...
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 n = int(input()) directions = input().strip() a = list(map(int, sys.stdin.readline().split())) ans = [] for i in range(n-1): if directions[i] == 'R' and directions[i+1] == 'L': ans.append((a[i+1]-a[i])//2) if ans: print(min(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
import java.util.*; import java.io.*; import java.math.*; public class Mahdi{ public static void main(String[] args) throws Exception{ //Scanner in =new Scanner(System.in); BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tok = new StringTokenizer(in.readLine...
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() d = [i for i in raw_input()] cord = [int(i) for i in raw_input().split()] cd = [(cord[i],d[i]) for i in xrange(n)] cd.sort() ans = 10**19 for i in xrange(n-1): if((cd[i][1]!=cd[i+1][1]) and (cd[i][1]=='R') and (cd[i][0]<cd[i+1][0])): temp = abs(cd[i][0]-cd[i+1][0])/2 ans = min(ans,temp) ...
PYTHON