Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const int inf = 2e9; int ara[200002]; int main() { int n; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) cin >> ara[i]; int res = inf, test = 0; for (int i = 0; i < n; i++) { if (s[i] == 'R' && s[i + 1] == 'L' && ara[i] < ara[i + 1]) res =...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String str = sc.next(); int max = 500000001; int now = 0; int prev; for(int i=0;i<n-1;i++){ prev = now; now = sc.nextInt(); if(str.charAt(i) == ...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; bool f = 0; cin >> n; string s; int sp[n]; cin >> s; int lol = INT_MAX; for (int i = 0; i < n; i++) { cin >> sp[i]; } for (int i = 0; i < n; i += 1) { if (s[i] == 'R' && ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
lst=[] z=int(input()) x=list(map(str,input())) c=list(map(int,input().split())) for v in range(z-1): if x[v]=='R': if x[v+1]=='L': b=(c[v+1]-c[v])//2 lst.append(b) if len(lst)!=0: print(min(lst)) else: print(-1)
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Scanner; public class Launchofcollidor { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); int n = input.nextInt(); String s = input.next(); int[] arr = new int[n]; for(int i=0;i<n;i++)arr[i] ...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const int MN = 1e9 + 7, MXN = 2e6 + 5; int n, mn = MN; bool u[MXN]; string s; int main() { cin >> n >> s; for (int i = 0; i < s.size(); i++) if (s[i] == 'R') u[i + 1] = 1; int x, y; cin >> x; for (int i = 2; i <= n; i++) { cin >> y; if (u[i - 1] && !u[...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) moves = list(input()) pos = [int(x) for x in input().split()] minTime = 1000000000 for i in range (n - 1): if moves[i] == 'R' and moves[i + 1] == 'L': time = int((pos[i + 1] - pos[i]) / 2) minTime = min(time, minTime) if minTime != 1000000000: print(minTime) else: print(-1)
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; void delbit(long long &a, long long k) { a &= (~(1 << k)); } bool getbit(long long a, long long k) { return 1 & (a >> k); } long long setbit(long long &a, long long k) { return a |= (1 << k); } inline long long mulmod(long long x, long long n, long long _mod) { long long ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n,s=int(input()),input() l,nl=[int(ele) for ele in input().split()],[] for i in range(len(s)): try: if s[i]=='R' and s[i+1]=='L': app=(l[i+1]-l[i])/2 nl.append(int(app)) except:continue if len(nl)==0:print(-1) else:print(min(nl))
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.*; import java.util.*; public class A1008 { public static void main(String [] args) /*throws Exception*/ { InputStream inputReader = System.in; OutputStream outputReader = System.out; InputReader in = new InputReader(inputReader);//new InputReader(new FileInputStream(new File...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner s= new Scan...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; public class helloWorld { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String str = in.next(); int[] ar = new int[n]; int ans = -1; int last = in.nextInt(); for(int i = 1; i < n; i++) { int a = in.nextInt(); if(str....
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.*; import java.text.*; import java.math.*; import java.util.*; public class q { public static void main(String[] args) { IO io = new IO(); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); if(n == 1) { io.pln("-1"); return; } String s = sc.nextLine...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; /** * * @author Loay mansour */ public class CodeForces { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { ar...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
var nbOfElement = Number(readline()); var direction = readline(); var elements = readline() .split(' ') .map(Number); var pair = []; for (var i = 1; i < nbOfElement; ++i) { if (direction[i - 1] === 'R' && direction[i] === 'L') { pair.push([i - 1, i]); } } var smallestPair = Infinity; for (var i = 0; i < p...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = input() m = raw_input() a = map(int,raw_input().split()) ans = 1000000001 if n == 1: print -1 else: for i in xrange(len(m)-1): if m[i] == 'R' and m[i+1] == 'L': ans = min(ans,a[i+1] - a[i]) if ans == 1000000001: print -1 else: print ans/2
PYTHON
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; string d; cin >> d; vector<long long> c; long long t; for (int i = 0; i < n; i++) { cin >> t; c.push_back(t); } long long mini = -1; for (int i = 0; i < n - 1; i++) { if (d[i] == 'R' && d[i + 1] == 'L') { ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.Input...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; void solve() { long long n; cin >> n; string s; cin >> s; vector<long long> v(n); for (long long i = 0; i <= n - 1; i++) cin >> v[i]; long long ans = mod; for (long long i = 0; i <= n - 2; i++) { if (s[i] == 'R' && s[i + 1]...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) s = input() a = list(map(int,input().split())) if "L" not in s: print(-1) exit(0) if "R" not in s: print(-1) exit(0) ans = [] flag = 0 for i in range(n): if s[i] == "R": right = a[i] flag = 1 elif flag and s[i] == "L": left = a[i] flag = 0 ...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) s = input() l = list(map(int, input().split())) # if n==1: # print(-1) answer = 9999999999 for i in range(len(l)-1): if s[i] == "R" and s[i+1]=="L": answer = min(answer, (l[i+1] - l[i])//2) if answer == 9999999999: print(-1) else: print(answer)
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { long long int t, min_t = -1; int n; long long int pos1, pos2; scanf("%d", &n); char a[n]; scanf("%s", &a); cin >> pos1; for (int i = 1; i < n; i++) { cin >> pos2; if (a[i - 1] == 'R' && a[i] == 'L') { t = (pos2 - pos1) / 2.0; ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Scanner; public class Q1 { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); String dir=s.next(); int cords[]=new int[n]; long temp=Long.MAX_VALUE; long min=Long.MAX_VALUE; for(int i=0;i<n;i++)cords[i]=s.nextInt(); for(int i=0;i<n-1;i++){ ...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
I=input R=range S=sorted n=int(I()) r=[[],[]] for s,v in zip(I(),map(int,I().split())):r[s=='R']+=[v] m=10**9 i=0 j=0 a=S(r[0]) b=S(r[1]) while i<len(a) and j<len(b): if b[j]>a[i]:i+=1 else:m=min(m,(a[i]-b[j])//2);j+=1 print([m,-1][m==10**9])
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
input() Move = input() X = list(map(int, input().split())) Count = 10 ** 10 i = 0 while i < len(X): if Move[i] == 'R': while i + 1 < len(X) and Move[i + 1] == 'R': i += 1 if 'L' not in Move[i:]: break Count = min(Count, (X[Move[i:].index('L') + i] - X[i]) // 2) ...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int ara[2000400]; int main() { int n; string s; long long int MIN = pow(2, 31); int dif = -1; cin >> n >> s; for (int i = 0; i < n; i++) { cin >> ara[i]; } for (int i = 0; i < n; i++) { if (s[i] == 'R' && s[i + 1] != 'R') { for (int j = i + 1; ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int n; int a[200001]; string s; long long giay = 1000000000; int main() { cin >> n; cin >> s; for (int i = 0; i < n; i++) cin >> a[i]; int i = 0; while (s[i] == 'L') i++; int r = n - 1; while (s[r] == 'R') r--; if (i > r) { cout << -1; return 0; } ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; import java.io.*; public class P699A { private static void solve() { int n = nextInt(); char[] dir = next().toCharArray(); int[] dist = new int[n]; for (int i = 0; i < n; i++) { dist[i] = nextInt(); } int ans = Integer.MAX_VALUE; for (int i = 0; i < n - 1; ...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#!/usr/bin/python3 inf = 1e9 def main(): n = int(input()) dir = input() coords = list(map(int, input().split())) res = inf maxr = -1 for i in range(n): if dir[i] == "R": maxr = coords[i] else: if maxr != -1: res = min((coords[i] - maxr) ...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class RUNNING { /** * @param args */ public static void main(String[] args) { Scanner sc= new Scanner(System.in); int n=sc.nextInt(); String s=sc.next(); long[]a= new long[n]; for(int i=0;...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
N = int(input()) if N == 1: print(-1) exit() S = input() X = list(map(int, input().split())) stk = [] ans = int(1e9) for s, x in zip(S, X): if len(stk) == 0: stk.append((s, x)) continue top = stk[-1] if top[0] == "R" and s == "L": ans = min(ans, x - (top[1] + x) // 2) ...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; string s; cin >> s; int lr = -1; int ans = 1000000001; for (int i = 0; i < n; i++) { int x; cin >> x; if (s[i] == 'R') { lr = x; } else { if (lr >= 0) {...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n=int(input()) s=input() l=list(map(int,input().split())) res=float("inf") ans=False if n==1: print(-1) else: for i in range(n-1): if (s[i]=="R" and s[i+1]=="L"): ans=True res=min(res,abs(l[i]-l[i+1])//2) if not ans: print(-1) else: print(res)
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int a[200001], b[200001]; int main() { long long n; cin >> n; for (long long i = 0; i < n; i++) { char s; cin >> s; if (s == 'L') a[i] = -1; else a[i] = 1; } for (int i = 0; i < n; i++) cin >> b[i]; bool flag = false; long long i = ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class A { public static void main(String[] args) throws IOException { Scanner sc= new Scanner(System.in); int n= sc.nextInt(); int arr[]= new int [...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5, oo = 2e9; char s[maxn]; int p[maxn], sh[maxn]; int ans = oo, n, i; bool cmp(int a, int b) { return p[a] < p[b]; } int main() { scanf("%d", &n); scanf("%s", s + 1); for (i = 1; i <= n; i++) { scanf("%d", &p[i]); sh[i] = i; } sort(sh + ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int a[200000 + 10]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) { cin >> a[i]; } int minn = INT_MAX; for (int i = 0; i < n - 1; i++) { if (s[i] == 'R' && s[i + ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
def algoritmo(): 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) alg...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int cev = 2000000000, n, a[200005]; char s[200005]; int main() { scanf("%d", &n); scanf("%s", s + 1); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); } for (int i = 1; i <= n; i++) { if (s[i] == 'R' && s[i + 1] == 'L') { cev = min(cev, (a[i + 1] -...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n; cin >> n; string s; cin >> s; int i; int minn = 1000000001; int flag = 0; int a[200000]; for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 0; i < n - 1; i++) { if (s[i] == 'R' && s[i + 1] == 'L...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) str = input() collider = input().split(' ') min = -1 for i in range(n-1): y = int(collider[i]) z = int(collider[i + 1]) if((str[i] == "R") and (str[i+1] == "L")): if(min > -1): if((z-y)/2 < min): min = (z-y)/2 if(min == -1): min = (z-y...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int n; char s[200100]; int pos[200100]; int main() { scanf("%d", &n); int mn = -1; scanf("%s", s); for (int i = 0; i < n; i++) scanf("%d", &pos[i]); for (int i = 1; i < n; i++) { if (s[i - 1] == 'R' && s[i] == 'L') if (mn == -1 || mn > (pos[i] - pos[i - ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n,ans=input(),10**10 s=raw_input() a=map(int, raw_input().split()) for i in range(n-1): if s[i:i+2] == "RL": ans = min(ans, (a[i+1] - a[i]) / 2) print ans if ans < 10**10 else -1
PYTHON
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; char dir[200005]; int a[200005]; int main() { int len, le, ri, minn, tmp; bool flag = 0; minn = 1000000000; scanf("%d", &len); scanf("%s", dir); le = 0; ri = len - 1; while (le <= ri) { if (dir[le] == 'L') le++; else break; } while (l...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(raw_input().strip()) di = raw_input().strip() pos = [int(x) for x in raw_input().strip().split()] ans = 1e12 for i in range(n-1): if (di[i] == 'R' and di[i+1] == 'L'): ans = min(ans, (pos[i+1]-pos[i])/2) if ans == 1e12: print -1 else: print ans
PYTHON
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; map<long long, long long> mp; int main() { int n; cin >> n; long long a[n], i, mn = 10000000000; char c[n + 1]; cin >> c; for (i = 0; i < n; i++) cin >> a[i]; for (i = 1; i < n; i++) { if (c[i] == 'L' && c[i - 1] == 'R') { mn = min(mn, a[i] - a[i - 1...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; import java.io.*; public class Solution699A { private static FastScanner in; private static PrintWriter out; public static void main(String[] args) { in = new FastScanner(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); n...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import sys import math import bisect import itertools import random import re def solve(A, B): n = len(A) min_val = 10 ** 18 for i in range(1, n): if A[i-1] == 'R' and A[i] == 'L': val = (B[i] - B[i-1]) // 2 min_val = min(min_val, val) if min_val == 10 ** 18: ret...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n=input() d=raw_input() p=map(int,raw_input().split()) mini=float('inf') for i in range(len(p)-1): j=i+1 if d[i]=='R' and d[j]=='L': if p[j]-p[i]<mini: mini=p[j]-p[i] print mini//2 if mini !=float('inf') else "-1"
PYTHON
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
c,k,n,a,l=-1,[],int(input()),input(),list(map(int,input().split())) for i in range(n): if a[i]=="R":c=i else: if c>=0:k.append((l[i]-l[c])//2) if len(k)==0:print(-1) else:print(min(k))
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Scanner; public class Test{ public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String arr = in.next(); int coor[] = new int[n]; for(int i=0; i<n; i++) { coor[i] = in.nextInt(); } int temp = 0; int count = Integer.MAX_VALUE; ...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n=int(input()) s=input() l=list(map(int, input().split())) ans =[l[i+1]-l[i] for i in range(n-1) if s[i+1] == 'L' and s[i] == 'R'] if ans: print((min(ans) // 2)) else: print(-1)
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) s = input() x = list(map(int, input().split())) t = [] flag = False for i in range(len(s)-1): if s[i]=='R' and s[i+1]=='L': t.append(i) flag = True if flag==False: print(-1) else: a = [] for i in t: a.append(x[i+1] - x[i]) print(min(a)//2)
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(raw_input()) mov = raw_input() pos = map(int, raw_input().split()) r = -1 for i in range(1, len(pos)): if mov[i-1] == mov[i]: continue else: if mov[i-1] == 'R' and mov[i] == 'L': if r == -1: r = pos[i] - pos[i - 1] r = min(r, (pos[i] - pos[i-1])/2) print r
PYTHON
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; import java.lang.*; import java.io.*; public class sample{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); if(!s.contains("RL")){ System.out.println(-1); } else{ ...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
def main(): n = input() s = input() L = [int(x) for x in input().split()] print(solver(s, L)) def solver(s, L): minimum = -1 for i in range(len(s) - 1): if s[i: i + 2] == "RL": cur = (L[i + 1] - L[i]) // 2 if minimum == -1 or cur < minimum: minimum = cur return minimum # print(solver("RLRL", [2, 4,...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; string str; int main() { int n, arr[200001]; cin >> n; cin >> str; for (int i = 0; i < n; i++) { cin >> arr[i]; } int ans, min = 1000000007; for (int i = 0; i < n - 1; i++) { if (str[i] == 'R' && str[i + 1] == 'L') { ans = arr[i + 1] - (arr[i + 1...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.*; public class Solution699A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); String s = sc.nextLine().trim(); int x1, x2, t = -1; x2 = sc.nextInt(); for (int i = 1; i < n; i++) { x1 = x2; x2 = sc.nextInt(); i...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = input() s = raw_input() arr = map(int, raw_input().split()) ans = 9999999999 i = 1 while i<n: if (s[i]=='L' and s[i-1]=='R') : k = abs(arr[i]-arr[i-1]) if ans>k: ans = k i+=1 #print ans/2 if ans == 9999999999: print -1 else: print ans/2
PYTHON
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
""" author - Sayan Bose date - 29.01.2020 Brooklyn 99 is love! """ n = int(input()) s = input() li = list(map(int, input().split())) res = [] for i in range(n): if s[i] == 'R': try: if s[i+1] == 'L': res.append((li[i+1]-li[i])//2) except IndexError: ...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n=input() st = raw_input(); arr = map(int,raw_input().split()) l1 = [arr[i+1]-arr[i] for i in xrange(0,n-1) if st[i+1]=='L' and st[i]=='R' ] if len(l1)==0: print -1 else: print min(l1)/2;
PYTHON
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; struct my { char ch; long long v; }; my ar[200010]; long long br[200010]; int main() { long long n; while (~scanf("%lld", &n)) { getchar(); long long i = 0, j = 0, x; char dir; for (j = 1; j <= n; j++) { scanf("%c", &dir); i++; ar[i...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) s = list(input()) x = input().split() min = -1 for i in range(n): x[i] = int(x[i]) for i in range(n-1): if(s[i]=='R' and s[i+1] == 'L'): m = int((x[i+1]-x[i])/2) if(min == -1 or m<min): min=m print(min)
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Arrays; import java.util.Scanner; public class tmp { public static void main(String[] Args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); long ans = (long) 2e18; int last = -1; for (int i = 0; i < n; i++) { int cur = sc.nextInt(); if (i != 0 && s...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
raw_input() dirs = raw_input() nums = map(int, raw_input().split()) dist = 10e10 start = dist for i in range(len(nums)-1): if dirs[i] == 'R': if dirs[i+1] == 'L': dist = min(dist, nums[i+1]-nums[i]) if dist == start: print -1 else: print dist/2
PYTHON
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; import java.ut...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int* numbers = new int[n]; for (int i = 0; i < n; i++) { cin >> numbers[i]; } int min_time = -1; for (int i = 0; i < n; i++) { if (s[i] == 'R') { int j = i + 1; if (j < n && s[j] == 'L')...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const int inf = 1e6 + 7, Inf = 1e9 + 7; int n, m, k = Inf, x, l, r, f, a[inf], b[inf], c[inf], d[inf]; map<int, int> p[inf]; vector<int> v; string s; int main() { cin >> n >> s; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 1; i < n; ++i) if (s[i] == 'L' &...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int n = 0, s = 1e9; cin >> n; char a[n]; int b[n]; cin >> a; for (int j = 0; j < n; j++) { cin >> b[j]; if (j > 0) { if (a[j - 1] == 'R' && a[j] == 'L') s = min(s, (b[j] - b[j - 1]) / 2); } } cout << ((s == 1e9) ? -1 : s); re...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int n; int a[200001]; int dir[200001]; string s; int main() { cin >> n; cin >> s; for (int i = (0); i < (n); ++i) dir[i] = (s[i] == 'R'); for (int i = (0); i < (n); ++i) cin >> a[i]; int res = -1; for (int i = (0); i < (n - 1); ++i) { if ((dir[i] ^ dir[i + 1...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner s= new Scanner(System.in); int n= s.nextInt(); s.nextLine(); int arr[]= new int[n]; String str = s.nextLine(); for(int i=0;i<n;i++){ arr[i]= s.next...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n=int(input()) l1=list(input()) l2=list(map(int,input().split())) ans=[];k=0 for i in range(n-1): if l1[i]=="R" and l1[i+1]=="L": k=1 break if k==0: print(-1) else: for i in range(n-1): if l1[i]=="R" and l1[i+1]=="L": ans.append((l2[i+1]-l2[i])//2) print(min(ans))
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); char[] s = input.next().toCharArray(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = input....
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; struct dbg_ { template <typename T> dbg_& operator,(const T& x) { cerr << x << ' '; return *this; } } dbg_t; struct cin_ { template <typename T> cin_& operator,(T& x) { cin >> x; return *this; } } cin_; template <typename T1, typename T2> static ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = input() directions = raw_input() coords = raw_input().split() min_distance = -1 for i in xrange(n-1): cur_dir = directions[i] cur_coord = int(coords[i]) next_dir = directions[i+1] next_coord = int(coords[i+1]) if cur_dir == next_dir: continue elif cur_dir == 'L' and next_dir == 'R'...
PYTHON
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; string s; cin >> s; vector<long> pos; for (int i = 0; i < n; i++) { long tmp; cin >> tmp; pos.push_back(tmp); } long min_val = pos[n - 1]; bool is_answer = false; for (int i = 0; i < n - 1; i++) { if (!(s...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { ios_base ::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; string s; cin >> s; vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } bool ok = false; int ans = 1e9; for (int i = 0; i < n;) { if (s[i] ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; long long int arr[200005]; int main() { long long int n, i, c, d, ans, mx, mn, k; string s; cin >> n; cin >> s; for (i = 0; i < n; i++) cin >> arr[i]; int f = 0; k = 0; mn = INT_MAX; for (i = 0; s[i]; i++) { if (s[i] == 'R') { f = 1; c = ar...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) s = input() x = list(map(int, input().split())) ans = 1000000001 r = s.find('R') l = s.find('L') if r!=-1 and l != -1: for i in range(0, n): if s[i] == 'R': r = i if s[i] == 'L': l = i if r < l: ans = min(ans, (x[l] - x[r])//2) if ans == ...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> int main() { long n, x[200001], i, min = 1111111111, temp; char s[200001]; scanf("%d %s", &n, s); for (i = 0; i < n; i++) scanf("%d", x + i); for (i = 0; i < n; i++) { if (s[i] == 'R' && s[i + 1] == 'L') { temp = (x[i + 1] - x[i]) / 2; if (min > temp) min = temp; }...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import math n=int(input()) a=input() b=list(map(int,input().split())) t=10**10 flag=0 for i in range(n-1): if(a[i]=="R" and a[i+1]=="L"): c=(b[i+1]-b[i])/2 t=min(t,math.ceil(c)) flag=1 if(flag==0): print(-1) else: print(t)
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.io.BufferedInputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedList; import java.util.Scanner; import java.util.Stack; import java.util.List; public class Main { private static Scanner input=new Scanner(System.in); public static void main(St...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
# print ("Input n") n = int(input()) # print ("Input the string of Ls and Rs") st = input() # print ("Input the starting positions, all on one line") a = list(int(x) for x in input().split()) collide = False smallesttime = None for i in range(0, len(a)-1): if st[i] == "R" and st[i+1] == "L": time = (a[i+1]...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const int eps = 1000000007; int inf = -1000000007; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<char> A(n); vector<int> B(n); for (int i = 0; i < n; i++) { cin >> A[i]; } for (int i = 0; i < n; i++) { cin...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int i, n, r = 2e9, a[200005]; char s[200005]; int main() { scanf("%d%s", &n, s + 1); for (i = 1; i <= n; i++) scanf("%d", a + i); for (i = 1; i < n; i++) if (s[i] == 'R' && s[i + 1] == 'L') r = min(r, a[i + 1] - a[i]); printf("%d", r < 2e9 ? r / 2 : -1); }
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { long int n; cin >> n; string s; cin >> s; long long int dha[n]; for (long long int a = 0; a < n; a++) { cin >> dha[a]; } long long int time = pow(10, 10); for (long long int a = 0; a < n - 1; a++) { if (s.at(a) == 'R' && s.at(a + 1) ==...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL), cout.tie(NULL); long long n, arr[300000], x, l = -1, ans = 10000000000, flag = 0; string s; cin >> n >> s; for (int i = 0; i < n; i++) { cin >> arr[i]; if (s[i] == 'R') l = arr[i]; else ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; vector<int> part; string s; int k, n; int main() { cin >> n; cin >> s; for (int i = 1; i <= n; i++) { cin >> k; part.push_back(k); } int ans = -1; for (int i = 1; i < n; i++) if (s[i - 1] == 'R' && s[i] == 'L') if ((part[i] - part[i - 1]) / 2 <...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) d = list(input()) k = [] m = 1000000001 k = [int(i) for i in input().split()] for i in range(n-1): if d[i] == 'R' and d[i+1] == 'L': if abs((k[i] - k[i+1])//2) < m: m = abs((k[i] - k[i+1])//2) if m == 1000000001: print(-1) else: print(m)
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const int MaxN = int(2e6) + 256; const int INF = int(1e9); const int mod = (int)(1e9) + 7; const double pi = 3.1415926535897932384626433832795; long long n, m, t, ans = INF, a[MaxN]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; string second;...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import sys, math n=int(input()) s=input() z=list(map(int,input().split())) best = 10**9 for i in range(len(s)-1): if s[i]=='R' and s[i+1]=='L': best=min(best, z[i+1]-(z[i]+z[i+1])//2) if best != 10**9: print(best) else: print(-1)
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
import java.util.Scanner; public class LaunchOfCollider { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); String symbols = sc.nextLine(); if(symbols.indexOf("RL") == -1) { sc.close(); S...
JAVA
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(raw_input()) ds = list(raw_input()) cors = map(int, raw_input().split()) res = 10**20 for _t in range(1, n): # judge cors[_t - 1] & cors[_t] if ds[_t - 1] == 'R' and ds[_t] == 'L': res = min(res, abs(cors[_t - 1] - cors[_t])/2) if res == 10**20: print -1 else: print res
PYTHON
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> const long long inf = 1e10; const int maxn = 200000 + 10; struct NN { int d; int x; } node[maxn]; int main() { char a; int n; while (std::cin >> n) { for (int i = 0; i < n; i++) { std::cin >> a; if (a == 'R') node[i].d = 1; else node[i].d = 0; ...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(raw_input()) directions = raw_input().strip() positions = list(map(int, raw_input().split())) result = -1 for i in range(1, n): if directions[i - 1] == 'R' and directions[i] == 'L': t = (positions[i] - positions[i - 1]) // 2 if result == -1 or t < result: result = t print(result)
PYTHON
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) d = list(input()) p = list(map(int, input().split())) output = -1 for i in range(1, n): if d[i - 1] == 'R' and d[i] == 'L': if output > 0: output = min(output, (p[i] - p[i - 1]) / 2) else: output = (p[i] - p[i - 1]) / 2 print(int(output))
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
n = int(input()) directions = input().strip() positions = list(map(int, input().split())) last_right_going = None min_t = None for position, direction in zip(positions, directions): if direction == 'L': if last_right_going is not None: time = (position - last_right_going) // 2 i...
PYTHON3
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; const int maxn = 200010; char mov[maxn]; int n, x[maxn], dis[maxn]; int ans = 0x7fffffff; void init() { cin >> n; cin >> (mov + 1); memset(dis, -1, sizeof(dis)); for (int i = 1; i <= n; i++) cin >> x[i]; } int firstfind() { for (int i = 1; i <= n; i++) if (mov...
CPP
699_A. Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista...
2
7
#include <bits/stdc++.h> using namespace std; int a[200001]; int main() { int n; cin >> n; string s; cin >> s; s = '*' + s; for (int i = 1; i <= n; i++) { cin >> a[i]; } int mins = 1e9; for (int i = 1; i < n; i++) if (s[i] == 'R') if (s[i + 1] == 'L') { mins = min(mins, (a[i + 1]...
CPP