prompt
string
response
string
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n=input() directions = str(input().strip()) items = list(map(int,input().strip().split())) l_bound = directions.find("R") if l_bound!=-1: min =None i=l_bound+1 #for i in range(l_bound+1,len(directions)): while i<len(directions): #print(i) if directions[i]=="L": if min==None o...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(raw_input()) str = raw_input() dis = map(int, raw_input().split(" ")) max = 100000000000000 dist = max for i in range(n-1): if str[i] == 'R' and str[i+1] == 'L' and dis[i+1]-dis[i]<dist: dist = dis[i+1]-dis[i] if dist == max: dist = -1 else: dist /= 2 print dist
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = input() p = list(raw_input()) posi = map(int,raw_input().split()) mini = 987654321 curpo = -1 for i in range(len(p)) : if p[i] == 'R' : curpo = posi[i] elif p[i] == 'L' : if curpo != -1 : t = (posi[i] - curpo)/2 mini = min(mini,t) if mini != 987654321 : print mini else : print -1
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; char direction[N]; int position[N]; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) cin >> direction[i]; for (int i = 0; i < n; ++i) cin >> position[i]; int answer = 0x3f3f3f3f; for (int rPtr = 0, lPtr = 0; rPtr < n; rPtr++) { ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n=int(input()) s=input() x = list(map(int, input().split(" "))) Min=10000000000000 for i in range(0,n-1): if s[i]=='R'and s[i+1]=='L': Min=min(Min,(x[i+1]-x[i])//2) print(Min if Min!=10000000000000 else -1)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int a[maxn]; char s[maxn]; int main() { int n; scanf("%d", &n); scanf("%s", s); for (int i = 0; i < n; ++i) { scanf("%d", a + i); } int ans = 2e9; for (int i = 1; i < n; ++i) { if (s[i - 1] == 'R' && s[i] == 'L') { ans =...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; const int N = 200000 + 1000; const int inf = 0x7fffffff; char ch[N]; int s[N]; int main() { int n; scanf("%d", &n); scanf("%s", ch); for (int i = 0; i < n; i++) scanf("%d", &s[i]); int len = strlen(ch); bool judge = true; int ans = inf; for (int i = 0; i < l...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import sys n = int(raw_input()) s = raw_input() a = map(int,raw_input().split()) d = sys.maxint for i in xrange(n-1) : if s[i] =='R' and s[i+1] == 'L' : d = min(d,a[i+1]-a[i]) if d == sys.maxint : print '-1' else : print d/2
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(raw_input()) s = raw_input() ans = 1e19 g =[] b = raw_input().split() for i in range(len(b)): g.append(int(b[i])) for i in range(1, n): if s[i - 1] == 'R' and s[i] == 'L': ans = min(ans, g[i] - g[i - 1]) if ans == 1e19: print(-1) else : print(ans // 2)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.*; public class p106 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int n = in.nextInt(); String str = in.next(); int ans= Integer.MAX_VALUE; int a[] = new int [n]; for (int i = 0; i < a.length; i++) { a[i]=in.ne...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { long int n, mx = 1000000000; string dir; cin >> n; cin >> dir; int arr[n]; cin >> arr[0]; for (int i = 1; i < n; i++) { cin >> arr[i]; if (dir[i - 1] == 'R' && dir[i] == 'L' && ((arr[i] - arr[i - 1]) / 2) < mx) mx = (arr[i] - arr[i -...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ; int n; cin >> n; vector<int> arr(n); string str; cin >> str; for (auto i = 0; i < (n); ++i) { cin >> arr[i]; } int MIN = INT_MAX; bool flag = false; for (auto i = 0; i < (n - 1); ++i) { ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) m = input() p = list(map(int,input().split())) x = [] if (m.find('RL') == -1): print(-1) else: for i in range(n): if (i != n-1): if ((m[i] == 'R') & (m[i+1] == 'L')): x.append((p[i+1]-p[i])//2) else: exit print(min(x))
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.ut...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#!/usr/bin/python import sys def main(): number_of_steps = raw_input() directions = raw_input() x_coords_str = raw_input() if not is_exist_collision(directions): print -1 exit(0) x_coords = x_coords_str.split() x_coord_index = find_nearest(x_coords, directions) print((int...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int m = 1e9; for (int i = 0; i < n; i++) if (s[i] == 'R' && s[i + 1] == 'L') m = min(m, (a[i + 1] - a[i]) / 2); if (m == 1e9) cout << -1 << endl; ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; const int mx = 200000; const int inf = 0x3f3f3f3f; int a[mx], z[mx], y[mx]; char s[mx]; int main() { int n, m; while (cin >> n) { scanf("%s", s); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } int maxx = inf; for (int i = 0; i < n - 1; i++...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
input() s = input() x = [int(i) for i in input().split()] res = -1 for i in range(len(x) - 1): if s[i] == "R" and s[i+1] == "L": if res == -1 or res > (x[i+1] - x[i]) // 2: res = (x[i+1] - x[i]) // 2 print(res)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import sys import math import itertools import collections def getdict(n): d = {} if type(n) is list or type(n) is str: for i in n: if i in d: d[i] += 1 else: d[i] = 1 else: for i in range(n): t = ii() if t in d...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.io.*; import java.util.*; public class Main { public void solve(){ int N = nextInt(); int[] X = new int[N]; TreeSet<Integer> left = new TreeSet<>(); String str = next(); for(int i = 0; i < N; i++){ X[i] = nextInt(); if(str.charAt(i) == 'L'){ left.add(X[i]); } } int ans = I...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import re n = input() s = raw_input() x = map(int, raw_input().split()) y=[m.start() for m in re.finditer('RL', s)] if not y: print -1 else: minimaldistance = 10**9; for i in y: minimaldistance = min(minimaldistance,(x[i+1]-x[i])>>1) print minimaldistance
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j; cin >> n; string s; cin >> s; int a[n]; for (i = 0; i < n; i++) { scanf("%d", &a[i]); } int flag = 0, mn = 1000000000, mid, x, y, d; for (i = 0; i < n; i++) { if (s[i] == 'R' && s[i + 1] == 'L') { flag = 1; x =...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; struct node { int rec; int dis; int left; int right; } ant[200005]; char st[200005]; bool cmp(node a, node b) { return (a.dis < b.dis); } int main() { int n; int a; scanf("%d", &n); scanf("%s", st); int len = strlen(st); for (int i = 0; i < len; ++i) { ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n, s, a = int(input()) - 1, input(), list(map(int, input().split())) b = [] for i in range(n): if s[i] == 'R' and s[i + 1] == 'L': b.append((a[i + 1] - a[i]) // 2) print(-1 if len(b) == 0 else min(b))
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; string s; cin >> s; vector<int> num(n); for (auto &x : num) cin >> x; int flag = 0; int t, res, min = 1e9; for (int i = 0; i < s.size() - 1; i++) { if (s[i] == '...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
T = input() cmds = raw_input().strip() nums = map(int, raw_input().strip().split()) pot = [] for i in xrange(len(cmds) - 1): if cmds[i:i+2] == "RL": pot.append(nums[i+1] - nums[i]) print min(pot)/2 if len(pot) != 0 else -1
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) s = input() x = list(map(int, input().split())) minimum = 10000000000 if s.count('RL') == 0: print(-1) else: for i in range(n - 1): if s[i] == 'R' and s[i + 1] == 'L' and x[i + 1] - x[i] < minimum: minimum = x[i + 1] - x[i] print(minimum // 2)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long n; cin >> n; string s; cin >> s; vector<long long> pos(n); for (long long i = 0; i < n; i++) cin >> pos[i]; long long ans = 1e12; bool found = 0; for (long long i = 0; i < n - 1; i++) { if...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int count = scanner.nextInt(); char[] dir = scanner.next().toCharArray(); int[] pos = new int[count]; for (int i = 0 ; i < count ; i++){ pos[i] = scanner.nextInt(); } ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.StringTokenizer; import javax.swing.plaf.synth.SynthSplitPaneUI; public class ProblemA { public static void main(String[] a...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) s = input() l = list(map(int,input().split())) d = [] for i in range(n-1): if s[i] == 'R' and s[i+1] == 'L': t =l[i+1] - l[i] t =t // 2 d.append(t) if d == []: print(-1) else: print(min(d))
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#!/usr/bin/python import sys def main(): number_of_steps = raw_input() directions = raw_input() x_coords_str = raw_input() x_coords = x_coords_str.split() x_coord_index = find_nearest(x_coords, directions) distance = (int(x_coords[x_coord_index + 1]) - int(x_coords[x_coord_index])) print...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) s = input() a = list(map(int, input().split())) maxl = -1 mini = 100000000000000000000000 for i in range(n): if s[i] == 'R': maxl = a[i] if s[i] == 'L' and maxl != -1: mini = min(mini, a[i] - maxl) if mini == 100000000000000000000000: print(-1) else: print(mini // 2)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.Scanner; /** * Created by pantism on 03/02/2016. */ public class _363_A{ public static int n,a[] = new int[200001]; static String x; public static void readData() { Scanner sc = new Scanner(System.in); n=sc.nextInt(); x = sc.nextLine(); x = sc.nextLine(); ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int a[200000]; for (int i = 0; i < n; i++) cin >> 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); if (ans == 1e9) cout...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; string s; cin >> s; vector<int> v; for (auto i = (0); i < (n); i++) { int x; cin >> x; v.push_back(x); } int ans = 2000000000; int i = 0; while (i < n) { if ((i < n - 1) and (s[i] == 'R') and (s[i + 1] == '...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import math n = int(input()) s = input() x = list(map(int,input().split())) i = 1 v = 10000000009 while(i<len(s)): if (s[i-1]=="R" and s[i]=="L" and math.ceil(( x[i]-x[i-1] ) / 2) < v ): v = math.ceil(( x[i]-x[i-1] ) / 2) i=i+1 if v!=10000000009: print(v) else: print(-1)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.Scanner; public class Launch_of_Collider { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; sc.nextLine(); // buffer String d = sc.nextLine(); for (int i = 0; i < n; i++) { ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(raw_input()) d = raw_input() x = map(int,raw_input().split()) ret = 1100000000 for i in range(1, n): if d[i-1] == 'R' and d[i] == 'L': ret = min(ret, (x[i] - x[i-1])//2) print ret if ret != 1100000000 else -1
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.*; import java.lang.*; import java.io.*; public class R363A { public static void main (String[] args) throws java.lang.Exception { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); TreeSet<Integer> tsr = new TreeSet<>(); Tre...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
def row(fn): return map(fn, raw_input().strip().split()) N = input() dir = list(raw_input()) pos = row(int) mi = float('+inf') for i in xrange(len(pos)): if i > 0 and dir[i] == 'L' and dir[i-1] == 'R': mi = min(mi, (pos[i] - pos[i-1]) / 2) print mi if mi < float('+inf') else -1
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.*; public class Dcoder { public static void main(String args[]) { Scanner input=new Scanner(System.in); int n = input.nextInt(); String s =input.next(); long [] a = new long[n]; for(int i=0;i<n;i++){ a[i]=input.nextInt(); } long min=1000000009; for(int ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.Scanner; public class Solution { private static final String RL = "RL"; public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); String directions = scanner.next(); int[] positions = new int[n]; for (int i = 0; i < n; i++) { positio...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(raw_input()) d = raw_input() x = map(int, raw_input().split()) y = [x[i] - x[i-1] for i in xrange(1, n) if d[i-1] == 'R' and d[i] == 'L'] print min(y)/2 if len(y) > 0 else -1
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.*; import java.io.*; import java.math.BigDecimal; public class TestClass{ static PrintWriter out = new PrintWriter(System.out); static HashMap v; static HashMap d; public static void main(String args[]) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in))...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) movement = list(input()) coord = list(map(int, input().split())) first_collision = float('inf') flag=False for i in range(len(coord) - 1): if movement[i] == 'R' and movement[i+1] == 'L': flag = True first_collision = min(first_collision, (coord[i+1] - coord[i]) // 2) if flag: pr...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import sys input = sys.stdin.readline print = sys.stdout.write def main(): n = int(input()) st = input().rstrip() arr = list(map(int, input().split())) answer = 10**18 for i in range(len(arr) - 1): if st[i] == "R" and st[i + 1] == "L": answer = min(answer, (arr[i + 1] - arr[i] ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) direction = str(input()) coord = list(map(int, input().split())) res = 10**9 + 1 for x in range(len(direction) - 1): if (direction[x] == 'R') and (direction[x+1] == 'L'): if (coord[x+1] - coord[x]) < res: res = coord[x+1] - coord[x] if res == 10**9 + 1: print('-1') else: ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
particles = int(input()) arrayOfMovement = list(str(input())) arrayOfCoordinates = list(map(int, input().split())) min = 10000000000 flag= 0 for i in range(0,len(arrayOfMovement)): if i != len(arrayOfMovement)-1 and arrayOfMovement[i] == 'R' and arrayOfMovement[i+1] == 'L': x = arrayOfCoordinates[i+1] - ar...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n=int(input()) s=input() a=[int(x) for x in input().split()] if 'RL' not in s: print(-1) exit(0) ans=1000000001 for i in range(0,n-1): if s[i]=='R' and s[i+1]=='L': if (a[i+1]-a[i])//2<ans: ans=(a[i+1]-a[i])//2 print(ans)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.io.*; import java.util.*; import java.lang.*; public class CfCOntest { static long mod = 1000000007; public static long power(long n,long k) { if(k==1) { return n; } if(k==0) { return 1; } long p = power(n, k/2); long d = (p%mod *p%mod)%mod; if(k%2==0) { return d; } els...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { char str[200005]; scanf("%s", str); int pos = 0; int r = -1; bool rf = false; bool lf = false; int ans = (1 << 30); for (int i = 0; i < n; i++) { int x; scanf("%d", &x); x = x >> 1;...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) d = input() if 'RL' not in d: print (-1) else: l = list(map(int,input().split())) r = min((l[x+1] - l[x]) // 2 for x in range(n-1) if d[x:x+2] =='RL') print (r)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#!/usr/bin/env python3 try: while True: n = int(input()) s = input() a = list(map(int, input().split())) result = -1 for i in range(1, n): if s[i - 1] == 'R' != s[i]: t = (a[i] - a[i - 1]) >> 1 if result == -1 or t < result: ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHel...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { int x, i, j, k, p = 10e9, c = 0; vector<int> v; cin >> x; char n[x + 1]; cin >> n; for (i = 0; i < x; i++) { cin >> k; v.push_back(k); } for (i = 0; i < x - 1; i++) { if (n[i] == 'R' && n[i + 1] == 'L') { k = v[i + 1] - v[i]; ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { int n; int ans = INT_MAX; string s; cin >> n >> s; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 1; i < n; i++) { if (s[i - 1] == 'R' && s[i] == 'L') ans = min(ans, (a[i] - a[i - 1]) >> 1); } if (ans == INT_MAX) cout ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) directions = input() positions = [int(c) for c in input().split()] collisions = [] for i in range(len(directions) - 1): if directions[i] == 'R' and directions[i + 1] == 'L': collisions.append((positions[i+1] - positions[i]) // 2) if not collisions: print(-1) else: print(min(collis...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(raw_input()) directs = raw_input() a = map(int,raw_input().split(' ')) ans = 15**9 for i in range(1,n): if (directs[i] == 'L') & (directs[i-1] == 'R'): ans = min(ans, (a[i]-a[i-1])/2) if ans == 15**9: print -1 else: print ans
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, i, min = 10000000000000, c = 0, FLAG = 0; cin >> n; long long a[n + 1]; char s[n + 1]; cin >> s; for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 0; i < n - 1; i++) { if ((s[i] == 'R') && (s[i + 1] == 'L')) { c = (a[i...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
cases = int(input()) directions = [i for i in input()] array = [int(i) for i in input().split()] count = -1 for i in range(1, cases): if directions[i] == 'L' and directions[i-1] == 'R': if array[i] - array[i-1] < count or count == -1: count = array[i] - array[i-1] if count == -1: print(count...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(raw_input()) dir = list(raw_input()) cor = map(int, raw_input().split()) mat = [] i = 0 while i < n - 1: if dir[i] == 'R' and dir[i+1] == 'L': mat.append((cor[i+1] - cor[i])/2) i += 2 else: i += 1 if len(mat) > 0: print min(mat) else: print -1
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = Integer.valueOf(s.nextLine()); int[] pos = new int[n]; char[] dir = s.nextLine().toCharArray(); int j = 0; int k = n; while(k-- ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), res = Integer.MAX_VALUE; String d = sc.next(); int prevx = sc.nextInt(); for(int i = 1 ; i < n; i++) { int x = sc.nextInt(); if(d.charAt(i-1) ==...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); long r=1000000000; int r0; int l=in.nextInt(); boolean b=false; String s=in.next(); int []arr=new int[l]; for (int i=0;i<l;i++){ arr[i]=in.nextInt()...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n=int(input()) s=input().rstrip() a=list(map(int,input().rstrip().split())) maxi=float('inf') for i in range(n-1): if s[i]=='R' and s[i+1]=='L': maxi=min(maxi,(a[i+1]-a[i])//2) if maxi==float('inf'): print(-1) else: print(maxi)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) t = input() z = float('inf') list1 = list(map(int,input().split())) for i in range(1,n): if t[i-1] == "R" and t[i] == "L": k = (list1[i]-list1[i-1])//2 z = min(z,k) if z == float("inf"): print(-1) else: print(z)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n=int(input()) s=input() m=list(map(int,input().split())) ans=[] if "RL" in s: f = s.index('R') s = s[f:] m = m[f:] for i in range(0,len(s)-1): a=s[i]+s[i+1] if a=="RL": ans.append((m[i+1]-m[i])//2) print(min(ans)) else: print(-1)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) dirs = input() vals = list(map(int, input().split())) found = False min = None for i in range(n - 1): ri = dirs[i] le = dirs[i + 1] if ri + le == 'RL': if (vals[i + 1] - vals[i]) % 2 == 0: found = True if min == None: min = (vals[i + 1] - vals...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int main() { int n, ans = 1e9; 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') ans = min(ans, ((arr[i + 1] - arr[i]) / 2)); }...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; vector<int> adj[2002]; bool visited[2002]; int V; int dist[2001]; vector<int> ans; vector<int> indegree; void BFS() { for (int k = 1; k <= V; k++) { int maxi = 0; int s = k; if (!visited[s] && indegree[s] == 1) { dist[s] = 0; list<int> q; vis...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
from sys import stdin, stdout import sys INF=1e11 import bisect def get_int(): return int(stdin.readline().strip()) def get_ints(): return map(int,stdin.readline().strip().split()) def get_array(): return list(map(int,stdin.readline().strip().split())) def get_string(): return stdin.readline().strip() def op(c): retur...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.Scanner; public class LaunchOfCollider { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); scan.nextLine(); String s = scan.nextLine(); String[] arr = scan.nextLine().split(" "); int ans = Integer.MAX_VALUE; for(int i = 0; i < n-1; ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int a[n]; int dis = INT_MAX; for (int i = 0; i < n; i++) { cin >> a[i]; if (i != 0) { if (s[i] == 'L' && s[i - 1] == 'R') { int x = a[i] - a[i - 1]; if (x < dis) dis = x; } ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.Scanner; /** * Created by Hp on 7/19/2016. */ public class A { public static void main(String [] ar){ Scanner s=new Scanner(System.in); int n=s.nextInt(); s.nextLine(); String st=s.nextLine(); long [] a=new long[n]; for(int i=0;i<n;i++)a[i]=s.next...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = input() s = raw_input() a = map(int, raw_input().split()) ans = 1 << 60 for i in range(1, n): if s[i - 1] == 'R' and s[i] == 'L': ans = min(ans, a[i] - a[i - 1] >> 1) print ans if ans < (1 << 60) else -1
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; const double PI = acos(0) * 2; const double EPS = 1e-8; const long long MOD = 1e9 + 7; const int MAXN = 1e5 + 5; const int oo = 1e9 + 10; const double foo = 1e30; template <class T> int getbit(T s, int i) { return (s >> i) & 1; } template <class T> T onbit(T s, int i) { ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, count = 0; cin >> n; long long int c[n]; string s; cin >> s; for (long long int i = 0; i < n; i++) { cin >> c[i]; } for (long long int i = 1; i < n; i++) { if (s.at(i) == 'L' && s.at(i - 1) == 'R') { c[count++] = a...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.*; public class Main { private static Scanner in = new Scanner(System.in); public static void main(String[] args) { // write your code here int n = in.nextInt(); int i, h; String direction = in.next(); if (!direction.contains("RL")) { System...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) s = input() l = [int(x) for x in input().split()] t = float('inf') for i in range(1, n): if s[i-1] == 'R' and s[i] == 'L': x = (l[i]-l[i-1])//2 t = min(x, t) if t == float('inf'): print(-1) else: print(t)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) s = input() l = list(map(int, input().split())) x=[] for i in range(n-1): if (s[i] == 'R' and s[i+1] == 'L'): x.append((l[i+1] - l[i])//2) if(len(x) == 0): print(-1) else: print(min(x))
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.*; public class Car { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String a = sc.next(); int[] arr = new int[n]; if (!a.contains("RL")) { System.out.print(-1); return; } int min = 1000000001; for (int i = 0; i < n; i++) arr[...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n=int(raw_input()) s=list(raw_input()) l=list(map(long,raw_input().split())) min_=789465561456545 c=0 for i in xrange(n-1): if s[i]=='R' and s[i+1]=='L': c=1 k=l[i+1]-l[i] if k<min_: min_=k if min_==1: break if c==0: print -1 else: print min_/2 ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
def main(): n_particles = int(input()) movements = input() positions = [int(_) for _ in input().split()] happened = -1 for i in range(n_particles - 1): if movements[i] == 'R' and movements[i + 1] == 'L': will_happen_in = (positions[i + 1] - positions[i]) // 2 if hap...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(input()) val = input() crd = list(map(int, input().split())) cur = -1 ans = 10 ** 19 for i in range(n): if val[i] == 'R': cur = i else: if cur != -1: ans = min(ans, (crd[i] - crd[cur]) // 2) if ans < 10 ** 19: print(ans) else: print(-1)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; long long choose(long long n, long long k) { if (k == 0) return 1; return (n * choose(n - 1, k - 1)) / k; } long long gcd(long long a, long long b) { if (!a) return b; return gcd(b % a, a); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll mod = 1e9 + 7; template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p); template <typename A, typename B, typename C, typename D> string to_string(t...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
k=['RL','LR'] n=int(input()) s=input() l=list(map(int, input().split())) minn=10**10; p=0 for i in range(n-1): if s[i:i+2]=='RL': minn=min(minn,(l[i+1]-l[i])//2) print(-1 if minn==10**10 else minn)
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
# input() # directions = input() # positions = list(map(int, input().split())) # times = [] # while directions.find('RL') != -1: # index = directions.find('RL') # times.append((positions[index+1] - positions[index])//2) # dir1 = directions[:index] # dir2 = directions[index + 2:] # directions = dir1 ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.util.Scanner; /* * 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. */ /** * * @author Dell */ public class NewMain59 { /** * @param args the command line arguments ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
n = int(raw_input()) f = raw_input() s = map(int,raw_input().split()) flag = 0 p = float('inf') for i in xrange(n): if f[i]=='L' and i>0 and f[i-1]=='R': p = s[i]-s[i-1] if s[i]-s[i-1]<p else p flag = 1 print p/2 if flag==1 else -1
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; vector<int> x(n, 0); for (int i = 0; i < n; i++) cin >> x[i]; int i = 0; int res = INT32_MAX; for (; i < n;) { if (s[i] != 'R') { ++i; continue; } else if (i < n - 1) { while (i < ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#77 n=int(input()) a=input() b=list(map(int,input().split())) r=[] for x in range(len(a)-1): if a[x]=='R' and a[x+1]=='L': r.append((b[x+1]-b[x])//2) if r== []: print(-1) else: print(min(r))
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int a[maxn]; int main() { int n; string ss; vector<int> L, R; cin >> n >> ss; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { if (ss[i] == 'R') R.push_back(a[i]); else L.push_back(a[i]); } ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> int main() { char RL[200005]; int m = 1000000000, n, a = 0, h = 0, i, j = 0, min; int coor[200005], orz[200005]; scanf("%d", &n); scanf("%s", RL); for (i = 0; i < n; i++) scanf("%d", &coor[i]); int b = n - 1; while (a < n && RL[a] == 'L') a++; while (b >= 0 && RL[b] == 'R') b-...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; char s[200001]; int a[200001]; int main() { int n; scanf("%d", &n); scanf("%s", &s); int i; for (i = 0; i < n; ++i) scanf("%d", &a[i]); int ans = 0x3f3f3f3f; int l, r; for (i = 1; i < n; ++i) { if (s[i] == 'L' && s[i - 1] == 'R') ans = min((a[i] - a[i - ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
import java.io.IOException; import java.util.InputMismatchException; public class AryansStuckAgain { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); int n = Integer.parseInt(sc.nextLine()); char[] ch = sc.nextLine().toCharArray(); int[] arr = sc.nextIntArray(n); int a=100000000...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> using namespace std; const int inf = 1000000000; const int maxn = 200005; char d[maxn]; int x[maxn]; int main() { int n, ans = inf; scanf("%d%s", &n, d); for (int i = 0; i < n; ++i) scanf("%d", x + i); for (int i = 1; i < n; ++i) { if (d[i - 1] == 'R' && d[i] == 'L') ans = min(ans, ...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
# import sys # sys.stdin=open("input.in",'r') # sys.stdout=open("outp.out",'w') n=int(input()) s=input() a=list(map(int,input().split())) f=0 for i in range(n): if f==0 and i<n-1 and s[i]=="R" and s[i+1]=="L": t=(a[i+1]-a[i])//2 f=1 elif i<n-1 and s[i]=="R" and s[i+1]=="L": t=min(t,(a[i+1]-a[i])//2) if f==0: p...
Problem: There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with ...
#include <bits/stdc++.h> const double PI = acos(-1.0); using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; int n, x; string s; cin >> n >> s; vector<int> left, right; for (int i = 0; i < n; i++) { cin >> x; if (s[i] == 'L') left.push_back(...