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 ...
def main(): n = input() s = input() d = input() number = [] res = False maxi = float('inf') for i in d.split(" "): number.append(int(i)) for i in range(len(s) - 1): if ( s[i] == "R" and s[i + 1] == "L" ): cal = number[i+1] - number[i] if (cal < max...
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()) ways=input() cordinates=list(map(int,input().split())) distances=[] for i in range (0,n-1): if ways[i]=='R' and ways[i+1]=='L': distances.append(cordinates[i+1]-cordinates[i]) if len(distances)>0: x=min(distances) print(int(x*0.5)) 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 mx = -1e9, mn = 1e9 + 5; long long T, n, m, k, ans, a[200005], b, c, d, l, r, sum, mid, coin, cnt, pos, number, x, y, z; vector<long long> v; map<long long, long long> mp, mm; map<long long, long long>::iterator it; pair<pair<long long, long long>, string> p[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 ...
NONE = 10 ** 10 n = int(input()) direct = input() pos = [int(x) for x in input().split()] best = NONE for i,x in enumerate(pos): if i+1 == n: break if direct[i:i+2] != 'RL': continue best = min(best, pos[i+1] - x) if best == NONE: best = -1 else: best = best // 2 print(best)
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.ArrayList; import java.util.Collections; import java.util.Scanner; public class ALaunchOfCollider { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n=in.nextInt();int m=0; String s=in.next();boolean ex=false;int moment=0; ArrayList<Integer> mommen...
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 elements = input() el_d = raw_input() elem_reach = [] el_x = map(int, raw_input().split()) for i in range(0,elements-1): if el_d[i] == 'R' and el_d[i+1] == 'L': elem_reach.append(el_x[i+1]-el_x[i]) if len(elem_reach)>0: elem_reach.sort() print elem_reach[0]/2 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,k = int(input()),input() l = list(map(int,input().split())) h = [(l[i+1]-l[i])//2 for i in range(n-1) if k[i]=='R' and k[i+1]=='L' ] if len(h)==0:print(-1) else:print(min(h))
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 take(): return raw_input().strip() def Convert(): return list(map(int,take().split())) N=int(take()) S=list(take()) arr,x=Convert(),[] for i in xrange(1,N): if S[i-1]=='R' and S[i]=='L': x.append((arr[i]-arr[i-1])/2) if len(x): print min(x) 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.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * * @author yanef */ public class test{ /** * @param args the command line arguments */ public static void main(String[] args) throws IOException{ BufferedRea...
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 ...
# -*- coding: utf-8 -*- """ Created on Fri Mar 27 23:49:08 2020 @author: alexi """ #http://codeforces.com/problemset/problem/699/A -- Alexis Galvan import math def particles(): total = int(input()) particles = input() particles = [i for i in particles] position = list(map(int, input().split())) ...
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 a, x[200009], ans = 1e9 + 9; char b[200009]; scanf("%d", &a); scanf("%s", b); for (int i = 0; i < a; i++) { scanf("%d", &x[i]); } for (int i = 0; i < a - 1; i++) { if (b[i] == 'R' && b[i + 1] == 'L') { ans = min(ans, (x[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 ...
n = int(input()) s = input() a = list(map(int, input().split())) ans = -1 for i in range(n-1): if s[i:i+2]=="RL": if ((abs(a[i]-a[i+1])//2)<ans) or (ans==-1): ans = abs(a[i]-a[i+1])//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 ...
/* * 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. */ //package cf; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Collections; imp...
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()) a = input() answer = float('infinity') A = list(map(int, input().split())) for i in range(n-1): if a[i]=='R' and a[i+1] == 'L': answer = min(answer, (A[i+1] - A[i])//2) if answer != float('infinity'): print(answer) 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()) velocities = input() coordinates = input() speed = [0] * n time = 10**9 coordinates = list(map(int, coordinates.split())) for i in range(len(velocities) - 1): if velocities[i] == 'R' and velocities[i + 1] == 'L': time = min(time, (coordinates[i + 1] - coordinates[i]) // 2) if time == 10*...
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()) st = input() lst = list(map(int, input().split())) minn = float("INF") yes = False for i in range(n-1): if st[i] == "R" and st[i+1] == "L": yes = True minn = min(minn, (lst[i+1] - lst[i])//2) if not yes: print(-1) else: print(minn)
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 min(int x, int y) { if (x > y) { return y; } else { return x; } } int main() { int n, x = INT_MAX; cin >> n; string s; cin >> s; int arr[n - 1]; cin >> arr[0]; for (int i = 1; i < n; i++) { cin >> arr[i]; if (s[i] == 'L' && 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 ...
n = input() s = raw_input() arr = map(int, raw_input().split()) mnL = 0 mnR = 99999999999 i = 0 while i<n: if s[i]=='L': if mnL<arr[i]: mnL = arr[i] else: if mnR>arr[i]: mnR = arr[i] i+=1 #print mnR,mnL if mnR<mnL: ans = 9999999999 i = 1 while i<n: ...
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, x, i, j, c; cin >> n; long long int arrrr[n]; string box; vector<int> container; int vk = 0; cin >> box; for (i = 0; i < n; i++) { cin >> arrrr[i]; } for (i = 0; i < n; i++) { if (box[i] == 'R' && box[i + 1] == '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 ...
n=int(raw_input()) s=raw_input() p=map(int,raw_input().split()) min_d=pow(10,10) for i in range(0,n-1,1): if(s[i]=='R' and s[i+1]=='L'): min_d=min(min_d,(p[i+1]-p[i])/2) if(min_d==pow(10,10)): 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 ...
#include <bits/stdc++.h> using namespace std; inline int in() { int res = 0; char c; int f = 1; while ((c = getchar()) < '0' || c > '9') if (c == '-') f = -1; while (c >= '0' && c <= '9') res = res * 10 + c - '0', c = getchar(); return res * f; } const int N = 100010, MOD = 1e9 + 7; int a[N]; int main()...
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.InputStreamReader; import java.util.StringTokenizer; public class A699 { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStream...
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 { FastReader scn; PrintWriter out; String INPUT = ""; void solve() { int n = scn.nextInt(); int[] dir = new int[n]; String s = scn.next(); for (int i = 0; i < n; i++) { if(s.charAt(i) == 'L') { dir[i] = -1; } else { dir[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 ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int n; cin >> n; string str; cin >> str; long long int arr[n]; long long int mini = INT_MAX; for (long long int i = 0; i < n; ++i) { cin >> arr[i]; if (i > 0 && str[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 ...
from sys import stdin,stdout,setrecursionlimit,maxint from math import ceil #setrecursionlimit(2*10**5) def listInput(): return map(long,stdin.readline().split()) def printBS(li): for i in xrange(len(li)-1): stdout.write("%d "%li[i]) stdout.write("%d\n"%li[-1]) n=input() sign=stdin.readline() li=listInput() r=0 mi...
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(false); cin.tie(NULL); int n, ans = 2000000000; string direction; cin >> n >> direction; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; for (int i = 0; i < n; i++) { if (direction[i] == 'R' && direction[...
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 ...
count = int(raw_input()) dirs = raw_input() particles = map(int , raw_input().split()) min = -1 rl = dirs.find("RL",0) if rl == -1 : print '-1' else: min = particles[rl+1] - particles[rl] for i in range(rl+1 , count): rl = dirs.find("RL",i) if rl == -1 : break min = particles[rl+1] - particles...
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() p = map(int, raw_input().split(' ')) MAXVAL = 100000000000 mind = MAXVAL for i in range(n-1): if d[i] == 'R' and d[i+1] == 'L': if (p[i+1]-p[i])/2 < mind: mind = (p[i+1]-p[i])/2 if mind != MAXVAL: print mind 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()) s=input() l=[int(x) for x in input().split()] ans=[] for i in range(len(l)-1): if s[i]=='R' and s[i+1]=='L': ans.append(l[i+1]-l[i]) print(min(ans)//2 if ans 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,ans = int(input()),10e12 sat = [i for i in input()] mat = list(map(int,input().split())) for i in range(n-1): if sat[i]== "R" and sat[i+1]=="L": ans = min(ans,(mat[i+1]-mat[i] + 1) // 2) print("-1" if ans==10e12 else 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.util.Scanner; public class A { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan=new Scanner(System.in); int n=scan.nextInt(); String s=scan.next(); int a[]=new int[n]; int ans=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 ...
#include <bits/stdc++.h> using namespace std; int main() { int n = 0, s = 1e9; cin >> n; char a[n]; int b[n]; cin >> a; for (int i = 0; i < n; i++) { cin >> b[i]; if (i > 0) { if (a[i - 1] == 'R' && a[i] == 'L') s = min(s, (b[i] - b[i - 1]) / 2); } } cout << ((s == 1e9) ? -1 : s); re...
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> char s[222222]; int ans[222222]; int main() { int n, i, tmp, mark, min1; while (scanf("%d", &n) != EOF) { mark = 0; min1 = 999999999; scanf("%s", s); for (i = 0; i < n; i++) scanf("%d", &ans[i]); for (i = 0; i < n - 1; i++) { if (s[i] == 'R' && s[i + 1] == '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 ...
#include <bits/stdc++.h> char arr[290000]; int in[290000]; int main() { int a, b, c, d; scanf("%d", &a); getchar(); int i; gets(arr); int s; int len = strlen(arr); int p = 0; for (i = 0; i < a; i++) { scanf("%d", in + i); } int min = INT_MAX; for (i = 0; i < a; i++) { if (arr[i] == '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 ...
n= int(input()) k = input() arr =[int(x) for x in input().split()] m=1000000001 for i in range(0,n-1): # print(len(m),len(n)) if k[i]=='R' and k[i+1]=='L': m=min(m,(arr[i+1]-arr[i])/2) # n+=k[i] # else: # m+=k[i] if m==1000000001: print(str(-1)) else: print(str(int(m)))
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()) moves = input() objects = input().split() objects = [int(el) for el in objects] def leftElIndex(i, n): return -1 if i - 1 < 0 else i - 1 def rightElIndex(i, n): return -1 if i + 1 >= n else i + 1 def collidesInSteps(i, j): if (j == -1 or moves[i] == moves[j] or moves[i] == "L" and moves[j...
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 ...
# https://codeforces.com/contest/699/problem/A # # Author: eloyhz # Date: Sep/03/2020 # if __name__ == '__main__': n = int(input()) d = input() a = [int(x) for x in input().split()] min_t = 10 ** 10 i = 0 while i < n: i = d.find('R', i) if i == -1: break whi...
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() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); long long n; cin >> n; string a; cin >> a; long long arr[n]; for (long long i = 0; i < (n); i++) cin >> arr[i]; long long ans = LLONG_MAX; bool c = true; for (long long i = 0; 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()) s = input() x = input().split() mn = 2000000000 for i in range(len(x)): if i > 0 and s[i]=='L' and s[i-1]=='R': mn = min(mn, (int(x[i])-int(x[i-1]))/2) if mn == 2000000000: print("-1") else: print(int(mn))
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() points = [int(x) for x in input().split()] answer = -1 for i in range(0, N-1): if directions[i]=='R' and directions[i+1]=='L': if answer==-1 or answer>(points[i+1]-points[i])//2: answer = (points[i+1]-points[i])//2 print (answer)
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())) l,z=[],0 for i in range(n-1): if (s[i]=='R' and s[i+1]=='L'): l.append((a[i+1]-a[i])//2) z=-1 if z==0: print(-1) else: print(min(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 ...
n = int(input().split()[0]) LR = input() X = list(map(int, input().split())) if n == 1: print('-1') exit() L = [-1 for i in range(n)] for i, lr in reversed(list(enumerate(LR))): if lr == 'L': L[i] = X[i] else: L[i] = L[(i + 1) % n] mint = float('inf') for i, lr in enumerate(LR): ...
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 = 200000 + 5; int main() { int n; cin >> n; string direc; cin >> direc; int pos[maxn]; for (int i = 0; i < n; i++) { cin >> pos[i]; } bool collision = false; int min_dis = INT_MAX; for (int i = 0; i < n - 1; i++) { if (direc[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 ...
def solve(): n = int(input()) movs = input() nums = [int(i) for i in input().split()] times = [] for i in range(len(movs)-1): if movs[i] == 'R' and movs[i+1] == 'L': times.append((nums[i+1] - nums[i])//2) if times: return min(times) return -1 print(solve())
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 ...
_, str, list = input(), input(), input().split(' ') ans = 1234567890 for i in range(1, len(str)): if str[i] == 'L' and str[i-1] == 'R': ans = min(ans, (int(list[i]) - int(list[i-1])) / 2) if ans == 1234567890: print(-1) else: print(int(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() { ios_base::sync_with_stdio(0); int n; cin >> n; string s; cin >> s; int a, b; int result = -1; for (int i = 0; i < n; i++) { cin >> a; if (i > 0 && s[i - 1] == 'R' && s[i] == 'L') { int dist = (a - b) / 2; if (dist < 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 ...
n=int(raw_input()) s=raw_input() x=map(int,raw_input().split()) d=10**10 for i in range(len(s)-1) : if s[i]=='R' and s[i+1]=='L': d=min(d,(x[i+1]-x[i])/2) else: pass if d!=10**10: print d 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()) s=str(input()) ip=list(map(int,input().split())) q=[1 for i in range(n)] op=[] for i in range(n): if s[i]=='L': q[i]=-q[i] for i in range(n-1): if q[i+1]-q[i]<0: op.append((ip[i+1]-ip[i])/abs(q[i+1]-q[i])) if len(op)==0: print(-1) else: print(int(min(op)))
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 launch { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int size = scan.nextInt(); String d = scan.next(); int[] nums = new int[size]; for (int i = 0; i < size; i++) { nums[i] = scan.nextInt(); } ArrayList<Integer> ind = new ArrayList<...
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 n=int(stdin.readline().rstrip()) s=stdin.readline().rstrip() l=list(map(int,stdin.readline().split())) m=float('inf') p=0 for i in range(n-1): if s[i]=="R" and s[i+1]=="L": ans=(l[i+1]-l[i])//2 m=min(ans,m) p=1 if p==0: print(-1) else: print(m)
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.*; //PrintWriter import java.math.*; //BigInteger, BigDecimal import java.util.*; //StringTokenizer, ArrayList public class R363_Div2_A { FastReader in; PrintWriter out; public static void main(String[] args) { new R363_Div2_A().run(); } void run() { in = new FastReader(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 ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long a[n], x1, mi = 10000000000, k = 0; char c[n]; for (int i = 0; i < n; i++) cin >> c[i]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { if (c[i] == 'L' && k == 1) { if (a[i] - x1 < mi) mi ...
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 itertools import product from math import ceil, gcd, sqrt import string from decimal import Decimal def binary_table(string_with_all_characters, length_to_make): return [''.join(x) for x in product(string_with_all_characters, repeat=length_to_make)] def all_possible_substrings(string): return [int(stri...
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() arr = list(map(int, input().split())) mn = float('inf') for i in range(n-1): if s[i] == 'R' and s[i+1] == 'L': mn = min(mn, arr[i+1] - arr[i]) if mn == 2: break if mn == float('inf'): print(-1) else: print(mn // 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(input()) di = input() pos = list(map(int,input().split())) mintime = 100000000000 for i in range(n-1): if di[i]=="R" and di[i+1]=="L": time = int((pos[i+1]-pos[i])/2) if time<mintime: mintime = time if mintime==100000000000: print(-1) else: print(mintime) ...
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()) list1=raw_input() list2=map(int,raw_input().split(" ")) times=[] start=0 ntimes=list1.count("RL") if ntimes==0: print -1 else: for i in xrange(0,ntimes): index=list1.find("RL",start) times.append((list2[index+1]-list2[index])/2) start=index+2 print sorted(times)[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 ...
import re Input=lambda:map(int,input().split()) n = int(input()) s = input() l = list(Input()) s = re.sub("RL","??",s) i = 0 MIN = float('inf') while i < n: if s[i] == '?': MIN = min(MIN,(l[i+1]-l[i])//2) i+=2 else: i+=1 print(MIN if MIN != 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 ...
h= int(input()) s2 = input() l1 = list(map(int, input().strip().split())) res = 999999999999 for i in range(0, len(s2)-1): if s2[i]=="R" and s2[i+1]=="L": res = min(res, (l1[i+1]-l1[ i])//2) if res == 999999999999: print(-1) else: 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 ...
#include <bits/stdc++.h> char dir[200005]; int pos[200005]; int main() { int N; int min = 1999999999; scanf("%d", &N); scanf("%s", dir); for (int i = 0; i < N; i++) { scanf("%d", &pos[i]); } int t; for (int i = 1; i < N; i++) { if (dir[i - 1] == 'R' && dir[i] == 'L') { t = (pos[i] - pos[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.util.*; import java.io.*; public class Main{ Scanner sc; public static void main(String[] args) throws IOException{ new Main().run(); } public void run() throws IOException{ sc = new Scanner(System.in); int n = sc.nextInt(); String[] m = sc.next().split(""); int[] num = new int[n]; 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 ...
n = int(input()) d = input() c = list(map(int, input().split())) anw = 1e10 for i in range(n-1): if d[i] == 'R' and d[i+1] == 'L': anw = min(anw, (c[i+1]-c[i])//2) if anw >= 1e10: print(-1) else: print(anw)
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.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.InputMismatchEx...
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; string s; cin >> n >> s; vector<int> v; for (int i = 0; i < n; i++) { int a; cin >> a; v.push_back(a); } long long res = 19999999999; for (int i = 0; i < s.size() - 1; i++) { if (s[i] == 'R' && s[i + 1] == '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 ...
#include <bits/stdc++.h> using namespace std; int main() { int n; string linea; scanf("%d", &n); cin >> linea; vector<int> posicion; for (int i = 0; i < n; i++) { int x; scanf("%d", &x); posicion.push_back(x); } int distanciaMinima = 1000000001; for (int i = 1; i < n; i++) { if (linea[...
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; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Test { //==========================Solution============================// public static void main(String[] args) { Fast...
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 = int(raw_input()) s = raw_input().strip() res = [int(k) for k in raw_input().strip().split(' ')] m = -1 for k in range(1, n): if s[k - 1] == 'R' and s[k] == 'L': if m != -1: m = min(m, (res[k] - res[k - 1]) / 2) else: m...
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 ProblemSolving { // minimum = Math.abs(Integer.parseInt(Character.toString(directions.charAt(i)))-Integer.parseInt(Character.toString(directions.charAt(i+1)))); public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.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()) dir = input() l = [int(i) for i in input().split()] right = [] left = [] for i in range(n): if dir[i] == "R": right.append(l[i]) else: left.append(l[i]) if right == [] or left ==[]: print(-1) else: maximum_left = max(left) minimum_right = min(right) if maximum_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 java.util.*; public class A{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String s = sc.next(); int ans = -1; int prev = sc.nextInt(); for(int i = 1; i < N; i++){ int next = sc.nextInt(); if(s.charAt(i)=='L' && s.charAt(i-1)=='R'){ 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 ...
"""609C""" # import math def main(): n = int(input()) string = str(input()) a = list(map(int,input().split())) mx = a[n-1]+100 for i in range(len(string)-1): if string[i]=="R" and string[i+1]=="L": mx = min((a[i+1]-a[i])//2,mx) if mx == a[n-1]+100: print("-1") else: print(mx) return main() # 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 ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWri...
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 found = 0 ans= 1000000000**3 n = int(stdin.readline()) a = stdin.readline().strip() b = map(int,stdin.readline().split()) st = 0 co=0 while True: if 'RL' in a[st:]: x = a.index('RL',st) cur = b[x+1]-b[x] if cur < ans: ans = cur st = x+2 else: break ans = ans/2 if ans > 10**20: 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 ...
var n=parseInt(readline()); var d=readline(); d += "E"; var pos=readline().split(' '); var mn = 1000000000; function go(el, i, a){ if(d[i] == 'R' && d[i+1] == 'L'){ mn = Math.min(mn, (a[i+1] - a[i])/2); }; }; pos.forEach(go); if(mn != 1000000000){ print(mn); } 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(raw_input()) s = raw_input() x = map(int, raw_input().split(' ')) ans = -1 for i in range(1, n): if s[i - 1] == 'R' and s[i] == 'L': if ans == -1: ans = (x[i] - x[i - 1]) / 2 else: ans = min(ans, (x[i] - x[i - 1]) / 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 ...
#include <bits/stdc++.h> using namespace std; int main() { int n, counter = 0; cin >> n; string s; int ans = INT_MAX; int flag = 0; int a[n + 1], i, j; cin >> s; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { if (s[i] == 'R' && s[i + 1] == 'L') { ans = min(ans, (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 ...
n = int(input()) s = input() l = list(map(int, input().split())) ans = 10 ** 18 last_r = -1 for i in range(len(l)): if s[i] == 'R': last_r = i else: if last_r != -1: ans = min(ans, (l[i] - l[last_r]) // 2) if ans == 10 ** 18: 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 ...
r=lambda:map(int,raw_input().split()) n=input() s=raw_input() x=r() m=x[-1]-x[0] p=0 for i in range(s.count('RL')): c = s.index('RL', p) m = min(m,(x[c + 1] - x[c])/2) p=c+1 if not s.count('RL'): print -1 else: print m
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 LaunchCollider { public static void main(String[] args) { Scanner input = new Scanner(System.in) ; int n = input.nextInt() ; String s = input.next().trim(); long parts [] = new long[n] ; for(int i = 0 ; i < n ; i++){ parts[i] = input.nextLong(); } input.close()...
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() t = map(int, raw_input().split()) ans = -1 for i in range(0, len(s)-1): if s[i:i+2] == "RL": v = (t[i+1] - t[i]) /2 ans = min(ans, v) if ans != -1 else v 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 ...
def readInt(): return int(raw_input()) def readList(): return map(int, raw_input().split(' ')) n = readInt() a = list(raw_input()) b = readList() m = -1 for i in xrange(n-1): if a[i] == 'R' and a[i+1] == 'L': j = (b[i+1] - b[i] + 1) / 2 if j < m or m == -1: m = j print m
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 n; string s; int arr[2000002]; bool ok; int ans = INT_MAX, last, cur; int main() { cin >> n; cin >> s; cin >> last; for (int i = 1; i < n; i++) { cin >> cur; if (s[i] == 'L' and s[i - 1] == 'R') { ans = min(ans, (cur - last) / 2); ok = 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 ...
from sys import stdin n =int(input()) str = stdin.readline() arr = list(map(int,stdin.readline().split())) r = neg = -1 p = 0 for i in range(n-1): if(str[i] == 'R' and str[i+1] == 'L'): r = int(( arr[i+1] - arr[i]) / 2) if(p == 0 or p > r): p = r if(r == -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 ...
import java.util.Scanner; public class Launch_of_Collider { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String move = in.next(); int max = Integer.MAX_VALUE; int k = -1; int[] arr = new int[n]; ...
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 RR1 { public static void main(String... xxx) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); String str = sc.nextLine(); int[] ar = new int[n]; for (int i = 0; i < n; i++) { ar[i] = s...
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; import java.util.Arrays; import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main ( String args[] ) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int a[]=new int[n]; int ans=Integer.MAX_VALUE; int ansa=Integer.MAX_VALUE; ...
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() { int n; scanf("%d", &n); char a[n]; long long b[n]; scanf("%s", a); for (int i = 0; i < n; i++) { scanf("%lld", &b[i]); } long long min = 10000000000; for (int i = 0; i < n; i++) { if (a[i] == 'R' && a[i + 1] == 'L') { int temp = b[i + 1] - b[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 sys input = sys.stdin.readline() #input = "3" num_elements = int(input) line2 = sys.stdin.readline() # line2 = "RLR" line3 = sys.stdin.readline() #line3 = "40 50 60" line3 = line3.split(' ') distance = []; for i in range(0, len(line2)-1): if line2[i:i+2] == 'RL': distance.append((int(line3[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.util.Scanner; public class Seasion7 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String str = in.next(); int[] arr = new int[n]; int ans = 0; for (int i = 0; i < n; 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; inline void pisz(int n) { printf("%d\n", n); } const int fx[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; const int fxx[8][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}}; template <typename T, typename TT> ostream& operator...
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.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = Syste...
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()) symbol=input() pos=list(map(int,input().rsplit())) min=2*10**9 cn=0 for i in range(0,n-1): if(symbol[i]=="R" and symbol[i+1]=="L"): _=abs(pos[i]-pos[i+1]) cn+=1 if(_<min): min=_ if(cn==0): print(-1) else: print(int(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 ...
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream 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 ...
#include <bits/stdc++.h> const int d4x[4] = {-1, 0, 1, 0}, d4y[4] = {0, 1, 0, -1}; const int d8x[8] = {-1, -1, -1, 0, 1, 1, 1, 0}, d8y[8] = {-1, 0, 1, 1, 1, 0, -1, -1}; using namespace std; int main() { int n; string s{}; cin >> n >> s; vector<int> v{}; for (int i{}; i < n; i++) { int a; cin...
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=list(input()) C=list(map(int,input().split())) an = None lastR = None for i,q in enumerate(S): if q == 'R': lastR = C[i] else: if lastR != None: if an == None: an = C[i] - lastR else: an = min(an, C[i] - lastR) if an != N...
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 int MAX_N = 10001; using namespace std; int main() { int n; int a[200001]; int b[200001]; int time[200001]; while (cin >> n) { getchar(); for (int i = 0; i < n; i++) { scanf("%c", &a[i]); } for (int i = 0; i < n; i++) { scanf("%d", &b[i]); } 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 T, n, k, mn, p[200005]; map<int, long long int> mp1, mp2; set<int> st; string str, str1; vector<int> ot; int main() { while (cin >> n) { mn = 2000000000; cin >> str; for (int u = 0; u < n; ++u) cin >> p[u]; for (int i = 0; i < str.size() - 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()) dir = input() pos = list(map(int, input().split(" "))) c = 1000000000 count = 0 for i in range(n-1): if dir[i]=="R" and dir[i+1]=="L": x = (pos[i+1]-pos[i])//2 count+=1 if x<c: c=x else: pass else: pass if count>=1: print(c) 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; char arr_dir[200001]; long long arr_x[200001]; int main() { std::ios_base::sync_with_stdio(0); long long n; cin >> n; for (long long i = 0; i < n; i++) { cin >> arr_dir[i]; } for (long long i = 0; i < n; i++) { cin >> arr_x[i]; } long long ans = 1000...
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 ...
# Name : Sachdev Hitesh # College : GLSICA rg = int(input()) user = input() a = list(map(int,input().split())) ans = [];flag=False for i in range(rg-1): if user[i]=='R' and user[i+1]=='L': b = a[i+1]-a[i] ans.append(b) flag = True if flag: print(int(min(ans)/2)) 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 math n = input() direc = raw_input() cord = list(map(int,raw_input().split())) minC = 9999999999 for i in range (n-1): if direc[i]=='R' and direc[i+1]=='L': col = (cord[i+1]-cord[i])/2 if col<minC: minC = col if minC == 9999999999: print -1 else: print int(minC)