import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n;
char ch[];
while(in.hasNext())
{
n=in.nextInt();
in.next();
String string=in.nextLine();
ch=string.toCharArray();
int[] a=new int[200050];
for(int i=0;i<n;i++)
{
a[i]=in.nextInt();
}
int Min=0x3f3f3f3f;
for(int i=0;i<n-1;i++)
{
if(ch[i]=='R'&&ch[i+1]=='L')
{
if(Min>(a[i+1]-a[i])/2)
{
Min=(a[i+1]-a[i])/2;
}
}
}
if(Min!=0x3f3f3f3f)
{
System.err.println(Min);
}
else
{
System.out.println("-1");
}
}
}
}
Codeforce Round 363(Div2)A(Java)
最新推荐文章于 2024-07-21 02:05:32 发布