Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> char s[200001]; int x[200000]; int main() { int N; scanf("%d %s", &N, s); int ans = -1; for (int i = 0; i < N; i++) scanf("%d", &x[i]); for (int i = 1; i < N; i++) if (s[i - 1] == 'R' && s[i] == 'L') { int t = (x[i] - x[i - 1]) / 2; if (ans < 0) ans = t; ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.util.InputMismatchException; import java.io.IOException; import java.util.Comparator; import java.io.InputStream; public class Main { public static void main(String[] ar...
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; import java.util.StringTokenizer; public class LaunchOfCollider { public static void main(String[] args) { FastReader reader = new FastReader(); int n = reader.nextInt(); String s = reader.nextLin...
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()) word = input() numbers = [int(i) for i in input().split()] distances = [] for pos in range(len(numbers)-1): distances.append(numbers[pos+1]-numbers[pos]) second_positions = [] for pos in range(len(numbers)): if word[pos]=="L": second_positions.append(numbers[pos]-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
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public ...
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 = 1000000010; const int maxn = 200005; int n; char s[maxn]; int a[maxn]; int read() { if (scanf("%d", &n) < 1) { return 0; } scanf("%s", &s); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } return 1; } void solve() { int ans = inf; ...
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 LaunchOfCollider { public static void main(String[] args){ Scanner kbd = new Scanner(System.in); int numOfParticles = Integer.parseInt(kbd.nextLine()); String movements = kbd.nextLine(); String[] particleCoordinates = kbd.nextLine().split(" ");...
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()) string = input() arr = list(map(int,input().split())) res = 1000000001 if 'RL' not in string: print('-1') else: for i in range(n): if i != n-1 and string[i] == 'R' and string[i+1] == 'L': if ((arr[i+1] - arr[i])//2) < res: res = (arr[i+1] - arr[i])...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) configuration = list(input()) x = 0 l1 = [int(num) for num in input().split(' ')] l2 = [] for i in range(len(configuration) - 1): if configuration[i] == 'R' and configuration[i + 1] == 'L' : l2.append(i) l3 = [] if len(l2) == 0: print(-1) else: for i in l2: l3.append(l1[i + ...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) direction = input() positions = list(map(int, input().split())) min_d = positions[-1] collide = False for index in range(n - 1): if direction[index] == 'R' and direction[index + 1] == 'L': collide = True min_d = min(min_d, positions[index + 1] - positions[index]) if collide: p...
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(); String str = sc.next(); int[] pos = new int[n]; for(int i = 0; i < n; i++) { pos[i] = sc.nextInt(); } ...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; import java.math.*; public class Me { public static void main(String[] args) { Scanner br=new Scanner(System.in); int n=br.nextInt(); String s=br.next(); int len=s.length(); int x=0,flag=0; int[] arr=new int[n]; for(int i=0;i<n;i++) { arr[i]=br.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
n=int(input()) s=input() a=list(map(int,input().split())) Min=2000000000; for i in range(n-1): if(s[i]=='R' and s[i+1]=='L'): Min=min(Min,a[i+1]-a[i]) if(Min!=2000000000): print(int(Min/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
/* * Remember a 6.0 student can know more than a 10.0 student. * Grades don't determine intelligence, they test obedience. * I Never Give Up. * I will become Candidate Master. * I will defeat Saurabh Anand. * Skills are Cheap,Passion is Priceless. */ import java.util.*; import java.util.Map.Entry; import java.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
//package CodeForces.Round363; import java.io.*; import java.util.HashMap; import java.util.StringTokenizer; /** * Created by ilya on 7/14/16. */ public class A699 { static HashMap<Long, Long> c = new HashMap<>(); public static void main(String[] args) { sc sc = new sc(); PrintWriter 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
import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException; import java.io.IOException;import java.io.PrintStream;import java.io.PrintWriter; import java.security.AccessControlException;import java.util.Arrays;import java.util.Collection; import java.util.Comparator;import java.util.List;im...
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 a699 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String s = in.next(); int ans = Integer.MAX_VALUE; int[] a = new int[n]; for (int i = 0; i < n; ++i) a[i] = in.nextInt(); for (int i = 0; i < n - 1; ++i) if (s.ch...
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.*; public class JavaApplication4{ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); char in1[] = new char[n]; int in2[] = 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.util.*; public class Test { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); int[] a = new int[n]; for(int i = 0; i < n; i++){ a[i] = sc.nextInt(); } sc.close(); int min = Integer.MAX_VALUE; for(int i = 0; i < s....
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; char a[10000000]; int aa[10000000]; int main() { int n; while (~scanf("%d", &n)) { scanf("%s", a); for (int i = 0; i < n; i++) { scanf("%d", &aa[i]); } int rr = 0; int ll = 0; for (int i = 0; i < n; i++) { if (rr == 0) { if (a...
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()) Directions = input() Positions = [int(x) for x in input().split()] timelist = [] if 'RL' in Directions: for i in range (n-1): if Directions[i] == 'R' and Directions[i+1] == 'L': time = (Positions[i+1] - Positions[i]) / 2 timelist.append(time) print(int(min(timel...
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 r[200008]; long long l[200008]; int main() { long long N, x, Nr = 0, Nl = 0; string str; cin >> N; cin >> str; long long ii = 0, ij = 0; for (long long i = 0; i < N; i++) { cin >> x; if (str[i] == 'R') { r[ii++] = x; Nr++; } els...
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()) t=input() x=[int(q) for q in input().split()] r=[] for i in range(n-1): if t[i]=="R" and t[i+1]=="L": r.append((abs(x[i+1]-x[i]))//2) if len(r)==0: print(-1) else: print(min(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
x=int(input()) y=list(input()) p=list(map(int,input().split())) mi=p[x-1]+1 for i in range(x-1): if y[i]=="R" and y[i+1]=="L": mi=min(mi,p[i+1]-p[i]) print(mi//2 if mi!=p[x-1]+1 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()) s=input() m=10**17 l=list(map(int,input().split())) for i in range(n-1): if s[i]!=s[i+1]: if s[i+1]!='R': m=min(m,(l[i+1]-l[i])//2) if (m==10**17): m=-1 print(m)
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.*; import java.util.*; public class Cf699A { public static void main(String args[]) throws IOException { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); //see n==1 char a[] = in.readString().toCharArr...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const int N = 1e6; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tc, ca = 0; int n, el; cin >> n; string s; cin >> s; vector<int> v; for (int i = 0; i < n; i++) { cin >> el; v.push_back(el); } int d = INT_MAX; for (int ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
# -*- coding:utf-8 -*- import sys def some_func(): """ """ n = input() n_str = map(str, sys.stdin.readline().split())[0] n_list = map(int, sys.stdin.readline().split()) cache = [] flag=0 temp=0 for v in range(n): if flag: if n_str[v]=='R': temp=...
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.*; import java.io.*; public class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int n = Integer.parseInt(br.readLine()); 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
#include <bits/stdc++.h> using namespace std; int main() { int n, i, ans = 1000000005; bool t = 0; cin >> n; int ina[n]; char cha[n + 2]; cin >> cha; for (i = 0; i < n; i++) cin >> ina[i]; for (i = 1; i < n; i++) { if (cha[i] < cha[i - 1]) { ans = min(ans, ina[i] - ina[i - 1]); t = 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
def main(): num = int(input()) directions = input() locations = list(map(int, input().split())) min_time = None for i in range(num - 1): if directions[i] == "R" and directions[i+1] == "L": time = (locations[i+1] - locations[i]) // 2 if min_time is None or time < min_t...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import sys n=int(input()) temp=input() list1=[int(x) for x in input().split()] leftRight=list(temp) minValue=sys.maxsize for i in range(len(leftRight)-1): if leftRight[i]=='R' and leftRight[i+1]=='L': meter=list1[i]+list1[i+1] meter//=2 if meter-list1[i]<minValue: minValue=met...
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())) 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.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class A699_Launch_of_Collider { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader ...
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, b, c= input(), list(map(int, input().split())), [] for i in range(n - 1): if a[i] == 'R' and a[i + 1] == 'L': c.append((b[i + 1] - b[i]) // 2) print(- 1 if len(c) == 0 else min(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
n = int(input()) moves = input() loc = [int(x) for x in input().split()] mins = int(10e20) for i in range(1, n): if moves[i-1] == "R" and moves[i] == "L": mins = min(mins, (loc[i] - loc[i-1])//2) print([-1, mins][mins != int(10e20)])
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
''' text = list() while True: try: l = raw_input() except EOFError: break else: text.append(l) ''' n = raw_input() dir = raw_input() x = raw_input().split() v = [] if dir[0] == 'R': v.append(1) else: v.append(-1) min_t = x[len(x)-1] q = False if len(x) > 1: for i in xrang...
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() pos = [int(i) for i in input().split()] min = 10**18 nosol = True for i in range(1,n): if s[i-1] == 'R' and s[i] == 'L': dist = pos[i] - pos[i-1] if dist < min: min = dist nosol = False if nosol: print(-1) else: print(min>>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
a = int(input()) b = input() c = input().split() e = [] for i in range(a-1): if b[i]=='R' and b[i+1]=='L': n = int(c[i]) m = int(c[i+1]) e.append(m-((m+n)//2)) if len(e)==0: print(-1) else: print(min(e))
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())) c,d,k=0,0,0 mini=10000000000000000 for i in range(len(s)): if(s[i]=='L'): c+=1 else: d+=1 if(c==len(s) or d==len(s)): k=1 if 'RL' not in s: k=1 ans=0 for i in range(len(a)-1): if(s[i]=="R" and s[i+1]=="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
#include <bits/stdc++.h> using namespace std; template <typename T> inline string tostring(T a) { ostringstream os(""); os << a; return os.str(); } template <typename T> inline long long tolong(T a) { long long res; istringstream os(a); os >> res; return res; } template <typename T> inline vector<int> par...
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() { long long n, i, minn = 100000000000; cin >> n; char RL[n]; long long cord[n]; vector<int> dif; for (i = 0; i < n; i++) { cin >> RL[i]; } for (i = 0; i < n; i++) { cin >> cord[i]; } for (i = 0; i < n - 1; i++) { if (RL[i] == 'R' &...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) dirs = input().strip() pos = tuple(int(_) for _ in input().split()) sentinel = 10 ** 9 + 1 best = sentinel i = dirs.find('RL') while i >= 0: best = min(best, pos[i+1] - pos[i]) i = dirs.find('RL', i+2) if best == sentinel: print(-1) else: print(best // 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; string s; int n, a[200100], i, x, mini = 2000001000, j; int main() { std::ios::sync_with_stdio(false); cin >> n; cin >> s; for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 0; i < n; i++) { if (s[i] == 'R') { for (j = i + 1; i < n; j++) { 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=input() l=list(map(int,input().split())) m=0 r=10**9 for i in range(n-1): if d[i]=='R' and d[i+1]=='L': m=(l[i+1]-l[i])/2 if m<r: r=m if r==10**9: print(-1) else: print(int(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
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java....
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
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import java.text.*; /** * * @author zulka...
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
num = input() pat = raw_input() array = raw_input() array = map(int, array.split(' ')) smallest = 1000000000 flag = 0 for i in xrange(0,int(num)-1): if pat[i] == pat[i+1]: continue elif pat[i] == 'L' and pat[i+1] == 'R': continue else: flag = 1 dis = array[i+1] - array[i] if dis<smallest: smallest = 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
//package aryans; import java.io.PrintStream; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; import java.util.SortedSet; import java.util.TreeSet; public class Main { private static Scanner in = new Scanner(System.in); private static PrintStream out = Sys...
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 Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); String s = sc.nextLine(); char[] directions = s.toCharArray(); int co...
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 can_solve(way,pos): k = 0 for a in range(1,len(way[0])): if way[0][a] == 'L' and way[0][a-1] == 'R': k = 1 break if k == 0: return -1 else: return solve(way,pos) def solve(way,pos): arr = [] for a in range(1,len(way[0])): count = 0 if way[0][a] == 'L' and way[0][a-1] == 'R': while pos[a] !...
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() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); int n; cin >> n; char a[200100] = {}; int b[200100] = {}; cin >> a; for (int i = 0; i < n; ++i) { cin >> b[i]; } char c = a[0]; int m = 1000000007; for (int i = 1; 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
n = input() s0 = raw_input() s = [s0[ch] for ch in range(len(s0))] p = [int(i) for i in raw_input().split()] ptest = p[:] for i in range(n): sign = 1 if(s[i] == 'L'): sign = -1; ptest[i]+=sign delta1 = [p[i+1]-p[i] for i in range(n-1)] delta2 = [ptest[i+1]-ptest[i] for i in range(n-1)] yes = 1 for i in range(len...
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() { long long int n, a[200010], m = INT_MAX; string s; cin >> n >> s; for (int i = 0; i < n; i++) cin >> a[i]; long long int j = -1; for (long long int i = 0; i < s.length(); i++) { if (s[i] == 'R') j = i; else { if (j != -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()) s = input() x = [int(y) for y in input().split(' ')] least_time = -1 for i in range(N - 1): if s[i] == 'R' and s[i + 1] == 'L': time = (x[i+1]-x[i])//2 if least_time == -1: least_time = time else: least_time = min(least_time, time) print(least_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(input()) s=list(input()) l=list(map(int,input().split())) ans=11**11 for i in range(n-1): if s[i]=='R' and s[i+1]=='L': t=(l[i+1]-l[i])//2 if ans>t: ans=t if ans==11**11: 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()) directions = [x for x in input()] points = [int(x) for x in input().split()] m = 9999999999999 flag = False for x in range(len(directions)-1): if directions[x] == "R" and directions[x+1] == "L": a =((points[x]+points[x+1]) /2) - points[x] flag = True if(a<m): m=a if flag: print(int(m...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
input() l=list(input()) x=list(map(int,input().split(' '))) p = [ i for i in range(len(l)-1) if l[i]=='R' and l[i+1]=='L'] if not p : print(-1) else : t = [x[i+1]-x[i] for i in p] print(min(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
n = int(input()) s = input() l = list(map(int, input().split())) res = 10**9 + 1 if n < 2: print(-1) exit(0) for i in range(n-1): if (s[i] == "R" and s[i+1] == "L") and (l[i+1] - l[i])//2 < res: res = (l[i+1] - l[i])//2 if res == 10**9 +1: print(-1) else: print(res)
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) s = input() a = [int(i) for i in input().split()] dis = [a[i+1] - a[i] for i in range(n-1) if s[i] == 'R' and s[i+1] == 'L'] if(dis): print(int(min(dis)/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 math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools import random sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return list(map(int, sys.stdin.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
#include <bits/stdc++.h> using namespace std; int main() { int n, k, v[200001] = {0}, i, minn = 1000000001; char s[200001]; bool ok = false; cin >> n; cin.get(); cin.getline(s, 200001); for (i = 0; i < n; i++) { cin >> v[i]; } for (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.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.FileReader; import java.io.InputStreamReader; import java.io.FileNotFoundException; import 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> #pragma GCC optimize(2) #pragma comment(linker, "/STACK:102400000,102400000") using namespace std; const long long mod = 998244353; const long long INF = 1e9 + 7; const int base = 131; const double eps = 0.000001; const double pi = 3.1415926; int n; int a[200010]; char str[200010]; int main() {...
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())) ans=1e10 lal=-1 lar=-1 for i in range(n): if s[i]=='L': if lar != -1: ans = min(ans,x[i]-x[lar]) lal = i elif s[i]=='R': lar = i if ans != 1e10: print(int(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.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class P699A { InputStream is; PrintWriter out; String INPUT = "3 LLR 40 50 60"; void solve() { int n = ni(); ...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int n; char s[200100]; int x[200100]; int main() { scanf("%d", &n); scanf("%s", s); int mint = 0x3f3f3f3f; for (int i = 0; i < n; i++) { scanf("%d", &x[i]); if (i && s[i] == 'L' && s[i - 1] == 'R') mint = min((x[i] - x[i - 1]) / 2, mint); } if (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
/** * Created by ankurverma1994 */ import java.io.*; import java.util.*; import java.math.*; public class Prob1 { final int mod = (int) 1e9 + 7; final double eps = 1e-6; final double pi = Math.PI; final long inf = Long.MAX_VALUE / 2; //------------> Solution starts here!! @SuppressWarnings(...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const int N = 200100; char s[N]; int n, pos[N], ans = 0x7fffffff; int Min(int x, int y) { if (x > y) return y; return x; } int main() { scanf("%d", &n); scanf("%s", s); for (int i = 1; i <= n; i++) scanf("%d", &pos[i]); 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
import math def inp(): return int(raw_input()) def linp(): return map(int, raw_input().split()) n=inp() s=list(raw_input()) li = linp() R=[] L=[] for i in xrange(len(s)): if s[i]=='L': L.append(li[i]) else: R.append(li[i]) ans = 2000000000 l = 0 if not R or not L: print -1 exit()...
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; const int maxn = 2e5 + 10; int n; string s; int a[maxn]; int main() { cin >> n >> s; for (int i = 0; i < n; i++) scanf("%d", &a[i]); int ans = 1e9; 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); } ...
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; char S[200010]; int main() { int n; scanf("%d", &n); scanf("%s", S); int l = -1; int best = 2e9; for (int i = 0; i < n; i++) { int p; scanf("%d", &p); if (S[i] == 'L') { if (l != -1) { best = min(best, (p - l) / 2); } } else {...
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; template <typename type> type input() { type var; cin >> var; return var; } template <typename type> void input(type &var) { cin >> var; return; } template <typename type> void output(type &var, const char *ch) { cout << var << ch; } int min(int a, int b) { retu...
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() x = list(map(int,input().split())) ind = direction.find("RL") if ind == -1: print(ind) exit() minimum = (x[ind+1]-x[ind])//2 for i in range(n-1): if direction[i]+direction[i+1]=='RL': if minimum>(x[i+1]-x[i])//2: minimum=(x[i+1]-x[i])//2 print(minimum)
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()) direc = raw_input() dist = [int(_) for _ in raw_input().split()] flagR = False R = -1 pico = [] for i in range(n): if(direc[i] == 'R'): flagR = True R = i elif(direc[i]=='L' and flagR): pico.append((dist[i] - dist[R])/2) if(len(pico) == 0): print(-1) else: ...
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 min1 = 999999999; int a[200000]; int n; cin >> n; string str; cin >> str; for (int i = 0; i < n; i++) cin >> a[i]; bool b = 0; for (int i = 0; i < str.size() - 1; i++) { if (str[i] == 'R' && str[i + 1] == 'L') { b = 1; brea...
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 math import inf def solve(): n = int(input()) movs = input() nums = [int(i) for i in input().split()] min_time = inf for i in range(len(movs)-1): if movs[i] == 'R' and movs[i+1] == 'L': current_time = (nums[i+1] - nums[i])//2 if current_time < min_time: 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
def main(): input() l, r = [], [] for c, x in zip(input(), map(int, input().split())): if c == 'L': l.append(x) else: r.append(x) ilo, ihi = iter(r), iter(l) res = 10 ** 10 try: lo, hi = next(ilo), next(ihi) while True: if lo < ...
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()) s = input() ans = 1234567890 i = 0 last_r = -1 for x in input().split(): now = int(x) if s[i] == 'R': last_r = now else: if last_r != -1: ans = min(ans,(now-last_r)//2) i+=1 if ans == 1234567890: 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.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.StringTokenizer; /** * Created by yujiahao on 9/20/16. */ public class cf_363_a { private FastScanner in; private PrintWriter out; public...
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.StringTokenizer; /** * Created by onigiri on 16/07/19. */ public class A { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintW...
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
IS=float('inf') xy=[(1,0),(-1,0),(0,1),(0,-1)] bs=[(-1,-1),(-1,1),(1,1),(1,-1)] def niten(a,b): return abs(a-b) if a>=0 and b>=0 else a+abs(b) if a>=0 else abs(a)+b if b>=0 else abs(abs(a)-abs(b)) def fib(n): return [(seq.append(seq[i-2] + seq[i-1]), seq[i-2])[1] for seq in [[0, 1]] for i in range(2, n)] def gcd(a,b):...
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; const int NMAX = 200005; int poz[NMAX], n; char dir[NMAX]; int mn; int main() { ios_base ::sync_with_stdio(false); cin.tie(NULL); cin >> n; cin >> dir; for (int i = 0; i < n; ++i) cin >> poz[i]; mn = 1e9; for (int i = 0; i < n - 1; ++i) if (dir[i] == 'R' &...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) s = input() x = list(map(int, input().split())) z = float('inf') for i in range(n - 1): if s[i] == 'R' and s[i + 1] == 'L': z = min(z, (x[i + 1] - x[i]) // 2) print(- 1 if z == float('inf') else z) # Codeforcesian
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.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws Exception{ // TODO Auto-generated method ...
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
hjCKMBTfcVYmswL = int hjCKMBTfcVYmswN = input hjCKMBTfcVYmswO = range hjCKMBTfcVYmswD = min hjCKMBTfcVYmswz = print n = hjCKMBTfcVYmswL(hjCKMBTfcVYmswN()) a = hjCKMBTfcVYmswN() b = [hjCKMBTfcVYmswL(_) for _ in hjCKMBTfcVYmswN().split()] x = -1 for i in hjCKMBTfcVYmswO(n - 1): if a[i] == 'R' and a[i + 1] == '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
import os from sys import stdin numField = int(stdin.readline()) directions = stdin.readline() length = list(map(int,stdin.readline().split(" "))) answer = [length[i+1]-length[i] for i in range(numField-1) if(directions[i]=='R' and directions[i+1]=='L')] if(answer): print(int(min(answer)/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
# your code goes here n=int(raw_input()) st=raw_input() li=map(int,raw_input().strip().split(" ")) maxx=-1 for i in range(0,n-1): if st[i]=="R" and st[i+1]=="L": if (li[i+1]-li[i])/2<maxx or maxx==-1: maxx=(li[i+1]-li[i])/2 print maxx
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 Q1 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); in.nextLine(); String s = in.nextLine(); int[] a = new int[n]; for(int i = 0; i < n; i ++ ) { a[i] = in.nextInt(); } int min = Integer.MAX_VALUE; 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
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.io.Buffered...
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() strs = raw_input() nums = map(int,raw_input().split(' ')) mins = 10000000000000000 for i in range(len(nums)-1): if strs[i]=='R' and strs[i+1]=='L': mins = min(mins,(nums[i+1]-nums[i])/2) if mins!=10000000000000000: print mins 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()) s=input() P=list(map(int,input().strip().split(' '))) start=0 MIN=10**10 last=-1 for i in range(N): if s[i]=='R': start=1 last=P[i] else: if start==1: temp=P[i] temp=(P[i]-last)//2 if temp<MIN: MIN=temp start=...
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 = list(input()) z = list(map(int, input().split())) a = list() c = 0 for i in range(n-1): if (s[i] == 'R') & (s[i+1] == 'L'): c += 1 break if (c == 0) | (n == 1): print('-1') exit() for i in range(n-1): if (s[i] == 'R') & (s[i+1] == 'L'): a.append(z[i+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()) s = input() x = [int(y) for y in input().split()] t = float('inf') pos = s.find('RL') if pos==-1: print(-1) else: while pos!=-1: t = min(t, (x[pos+1]-x[pos])/2) pos = s.find('RL', pos+1) print(int(t))
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
/** * Created by Khoi on 19/10/2017 * For learning purpose */ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class main { InputStream is; PrintWriter 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
t=input() a=raw_input() a=list(a) b=map(int,raw_input().split()) min1=[] if len(set(a))==1: print -1 else: F=0 for i in range(0,t-1): if (a[i]=='R' and a[i+1]=='L'): F=1 min1.append(b[i+1]-b[i]) if F==1: print min(min1)/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
/*بِسْمِ Ψ§Ω„Ω„ΩŽΩ‘Ω‡Ω Ψ§Ω„Ψ±ΩŽΩ‘Ψ­Ω’Ω…ΩŽΩ†Ω Ψ§Ω„Ψ±ΩŽΩ‘Ψ­ΩΩŠΩ…*/ //codeforces_699A import java.io.*; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import static java.lang.Math.*; import java.math.*; public class Main{ static PrintWriter go = new PrintWriter(System.out); 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
n=int(input()) t=input() s=list(map(int,input().split())) if n==1: print(-1) else: p=[] for k in range(n-1): if t[k]=='R': if t[k+1]=='L': p.append((s[k+1]-s[k])//2) if len(p)==0: print(-1) else: print(min(p))
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public final class Solution { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner s...
JAVA