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 |
|---|---|---|---|---|---|
625_D. Finals in arithmetic | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
int main() {
char s[100005];
int n, l, r;
while ((scanf("%c", &s[++n]) == 1) && (s[n] >= '0') && (s[n] <= '9'))
s[n] -= '0';
l = 1;
r = --n;
if (s[l] != s[r]) {
s[l]--;
s[l + 1] += 10;
if (s[l] == 0) l++;
}
while (l <= r) {
if (s[l] != s[... | CPP |
625_D. Finals in arithmetic | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
char num[100005];
int n[100005];
char left[100005];
int len;
bool Cout[100005];
int ans[100005];
bool check(int start) {
for (int i = start, j = len - 1; j >= i; j--, i++) {
int t1 = n[i] + 10 * Cout[i], t2 = n[j] + 10 * Cout[j];
if (t1 == t2) {
if (t1 > 18 ... | CPP |
625_D. Finals in arithmetic | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
inline int init() {
int now = 0, ju = 1;
char c;
bool flag = false;
while (1) {
c = getchar();
if (c == '-')
ju = -1;
else if (c >= '0' && c <= '9') {
now = now * 10 + c - '0';
flag = true;
} else if (flag)
return now * ju;
... | CPP |
625_D. Finals in arithmetic | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 2 | 10 | #include <bits/stdc++.h>
char s[100010];
int a[100010], ans[100010];
int main() {
scanf("%s", s);
int len = strlen(s);
for (int i = 0; i < len; i++) a[i] = s[i] - '0';
int l = 0, r = len - 1, fa = 1;
if (a[l] != a[r]) {
a[l]--;
a[l + 1] = a[l + 1] + 10;
if (a[l] == 0) l++;
}
while (l <= r) {
... | CPP |
625_D. Finals in arithmetic | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
char s[100005];
int n, a[100005], ans[100005];
inline bool find() {
int i = 1, j = n;
while (i <= j) {
if (a[i] == a[j]) {
i++;
j--;
} else if (a[i] == a[j] + 10) {
a[j - 1]--;
a[j] += 10;
} else if ((a[i] == a[j] + 1) || (a[i] == a[j... | CPP |
625_D. Finals in arithmetic | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
long long powmod(long long a, long long b, long long MOD) {
long long res = 1;
a %= MOD;
for (; b; b >>= 1) {
if (b & 1) res = res * a % MOD;
a = a * a % MOD;
}
return res;
}
const int N = 1E5 + 5;
char s[N];
int a[N];
char out[N];
bool solve(int n) {
fo... | CPP |
625_D. Finals in arithmetic | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 2 | 10 | import java.util.Scanner;
public class R625D {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s = in.next();
if (s.equals("1"))
{
System.out.print("0");
return;
}
int[] n = new int[s.length()];
int[] ans = new int[s.length()];
for (int i=0; i<s.length(); i+... | JAVA |
625_D. Finals in arithmetic | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
int a[100010], n, ans[100010];
bool f[100010][10][2][2];
char c;
bool dfs(int k, int r1, int r2, int x) {
if ((n & 1) == 0 && k > n / 2)
return r1 == r2;
else if ((n & 1) == 1 && k > n / 2) {
if ((r2 * 10 + a[k] - r1) & 1) return f[k][x][r1][r2] = true, false;
... | CPP |
625_D. Finals in arithmetic | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int a[N];
char s[N];
char out[N];
int main() {
scanf("%s", s + 1);
int n = strlen(s + 1);
for (int i = 1; i <= n; i++) a[i] = s[i] - '0';
int l = 1, r = n;
if (a[l] != a[r]) {
a[l]--;
a[l + 1] += 10;
if (!a[l]) l++;
}
while (... | CPP |
625_D. Finals in arithmetic | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
bool SR(int &x) { return scanf("%d", &x) == 1; }
bool SR(long long &x) { return scanf("%lld", &x) == 1; }
bool SR(double &x) { return scanf("%lf", &x) == 1; }
bool SR(char *s) { return scanf("%s", s) == 1; }
bool RI() { return true; }
template <typename I, typename... T>
bo... | CPP |
625_D. Finals in arithmetic | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
int num[102400], len;
bool dfs() {
int i = 0, j = len - 1;
while (i < j) {
if (num[i] == num[j]) {
i++;
j--;
continue;
}
if (num[i] - num[j] == 10) {
num[j - 1]--;
num[j] += 10;
} else if (num[i] - num[j] == 1 || num[i] - nu... | CPP |
625_D. Finals in arithmetic | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
char f[100500];
char res[100500];
bool go(int carry, int n, char* f) {
int pl = 0, pr = n - 1;
int prev_carry = 0;
while (pl < pr) {
int next_carry = 0;
if (f[pl] == (f[pr] - prev_carry + 10) % 10) {
if (carry) {
res[pl] = 9;
res[pr] = 10... | CPP |
673_F. Bearish Fanpages | There is a social website with n fanpages, numbered 1 through n. There are also n companies, and the i-th company owns the i-th fanpage.
Recently, the website created a feature called following. Each fanpage must choose exactly one other fanpage to follow.
The website doesn’t allow a situation where i follows j and a... | 2 | 12 | #include <bits/stdc++.h>
using namespace std;
int Q, N, M, K, L;
long long FAN[100001];
int p[100001];
long long v[100001];
struct comp {
bool operator()(const int& a, const int& b) const {
if (v[a] != v[b]) return v[a] < v[b];
return a < b;
}
};
set<int, comp> children[100001];
int deg[100001];
multiset<lo... | CPP |
673_F. Bearish Fanpages | There is a social website with n fanpages, numbered 1 through n. There are also n companies, and the i-th company owns the i-th fanpage.
Recently, the website created a feature called following. Each fanpage must choose exactly one other fanpage to follow.
The website doesn’t allow a situation where i follows j and a... | 2 | 12 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using D = double;
using uint = unsigned int;
const int maxn = 100005;
ll t[maxn], others[maxn], me[maxn];
int f[maxn];
vector<int> from[maxn];
int kv[maxn];
ll ans[maxn];
int n, m;
multiset<ll> global;
multiset<ll> cur[maxn];
bo... | CPP |
673_F. Bearish Fanpages | There is a social website with n fanpages, numbered 1 through n. There are also n companies, and the i-th company owns the i-th fanpage.
Recently, the website created a feature called following. Each fanpage must choose exactly one other fanpage to follow.
The website doesn’t allow a situation where i follows j and a... | 2 | 12 | #include <bits/stdc++.h>
using namespace std;
inline int ReadInt() {
static int n, ch;
n = 0, ch = getchar();
while (!isdigit(ch)) ch = getchar();
while (isdigit(ch)) n = (n << 1) + (n << 3) + ch - '0', ch = getchar();
return n;
}
inline long long ReadLL() {
static long long n;
static int ch;
n = 0, ch ... | CPP |
673_F. Bearish Fanpages | There is a social website with n fanpages, numbered 1 through n. There are also n companies, and the i-th company owns the i-th fanpage.
Recently, the website created a feature called following. Each fanpage must choose exactly one other fanpage to follow.
The website doesn’t allow a situation where i follows j and a... | 2 | 12 | #include <bits/stdc++.h>
using namespace std;
inline int ReadInt() {
static int n, ch;
n = 0, ch = getchar();
while (!isdigit(ch)) ch = getchar();
while (isdigit(ch)) n = (n << 1) + (n << 3) + ch - '0', ch = getchar();
return n;
}
inline long long ReadLL() {
static long long n;
static int ch;
n = 0, ch ... | CPP |
673_F. Bearish Fanpages | There is a social website with n fanpages, numbered 1 through n. There are also n companies, and the i-th company owns the i-th fanpage.
Recently, the website created a feature called following. Each fanpage must choose exactly one other fanpage to follow.
The website doesn’t allow a situation where i follows j and a... | 2 | 12 | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long x = 0;
char ch = getchar();
bool f = 0;
for (; !isdigit(ch); ch = getchar())
if (ch == '-') f = 1;
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
return f ? -x : x;
}
void write(long long x) {
if (x < 0) putc... | CPP |
673_F. Bearish Fanpages | There is a social website with n fanpages, numbered 1 through n. There are also n companies, and the i-th company owns the i-th fanpage.
Recently, the website created a feature called following. Each fanpage must choose exactly one other fanpage to follow.
The website doesn’t allow a situation where i follows j and a... | 2 | 12 | #include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 100005;
int n, q, k[MAXN], f[MAXN];
long long t[MAXN], sum[MAXN];
multiset<long long> A[MAXN], all;
void modifyAll(int x, int del) {
if (A[x].empty()) return;
if (!del) {
all.erase(all.lower_bound(t[x] / (k[x] + 2) + *A[x... | CPP |
673_F. Bearish Fanpages | There is a social website with n fanpages, numbered 1 through n. There are also n companies, and the i-th company owns the i-th fanpage.
Recently, the website created a feature called following. Each fanpage must choose exactly one other fanpage to follow.
The website doesn’t allow a situation where i follows j and a... | 2 | 12 | #include <bits/stdc++.h>
using namespace std;
const long long inf = 4e18;
const long long maxn = 2e5 + 10;
const long long mod = 1e9 + 7;
long long a[maxn], f[maxn], val[maxn], dg[maxn];
set<pair<long long, long long> > s[maxn];
set<pair<long long, long long> > tot;
inline void Add(long long x) {
if (s[x].empty()) re... | CPP |
673_F. Bearish Fanpages | There is a social website with n fanpages, numbered 1 through n. There are also n companies, and the i-th company owns the i-th fanpage.
Recently, the website created a feature called following. Each fanpage must choose exactly one other fanpage to follow.
The website doesn’t allow a situation where i follows j and a... | 2 | 12 | #include <bits/stdc++.h>
using namespace std;
inline int ReadInt() {
static int n, ch;
n = 0, ch = getchar();
while (!isdigit(ch)) ch = getchar();
while (isdigit(ch)) n = (n << 1) + (n << 3) + ch - '0', ch = getchar();
return n;
}
inline long long ReadLL() {
static long long n;
static int ch;
n = 0, ch ... | CPP |
673_F. Bearish Fanpages | There is a social website with n fanpages, numbered 1 through n. There are also n companies, and the i-th company owns the i-th fanpage.
Recently, the website created a feature called following. Each fanpage must choose exactly one other fanpage to follow.
The website doesn’t allow a situation where i follows j and a... | 2 | 12 | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long x = 0;
char ch = getchar();
bool f = 0;
for (; !isdigit(ch); ch = getchar())
if (ch == '-') f = 1;
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
return f ? -x : x;
}
void write(long long x) {
if (x < 0) putc... | CPP |
673_F. Bearish Fanpages | There is a social website with n fanpages, numbered 1 through n. There are also n companies, and the i-th company owns the i-th fanpage.
Recently, the website created a feature called following. Each fanpage must choose exactly one other fanpage to follow.
The website doesn’t allow a situation where i follows j and a... | 2 | 12 | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long x = 0;
char ch = getchar();
bool f = 0;
for (; !isdigit(ch); ch = getchar())
if (ch == '-') f = 1;
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
return f ? -x : x;
}
void write(long long x) {
if (x < 0) putc... | 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
def main(arr):
curr = None
m = float("inf")
for d, pos in arr:
if d == 'L':
if curr is not None:
m = min(m, pos - curr)
elif d == 'R':
curr = pos
print(m // 2 if m != float("inf") else -1)
if __name__ == "__main__":
arr = []
fo... | 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())
x=input()
a=list(map(int,input().split()));m=[]
if 'RL' not in x:print(-1)
else:
for i in range(n-1):
if x[i]+x[i+1]=='RL':m.append((a[i+1]-a[i])//2)
print(min(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;
int main() {
int i, j, n, arr[200004], m = INT_MAX;
char a[200004];
cin >> n;
cin >> a;
for (i = 0; i < n; i++) cin >> arr[i];
int flag = 0;
if (n == 1)
cout << "-1\n";
else {
i = 0;
while (i < n) {
while (a[i] == 'L' && i < n) i++;
w... | 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.*;
/**
* @author Alexander Tsupko (alexander.tsupko@outlook.com)
* (c) Codeforces Round 363. All rights reserved. July 19, 2016.
*/
public class A {
private static class Solve {
// instance variables
private void solve(int testNumber, InputReader in, OutputWri... | JAVA |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | import sys
n = int(input())
s = input()
k = list(map( int, input().split()))
if n == 1:
print(-1)
sys.exit()
ans = []
for i in range(n - 1):
if s[i] == 'R' and s[i + 1] == 'L':
f = (k[i + 1] - k[i]) // 2
ans.append(f)
if ans:
print(min(ans))
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;
int main() {
string str;
int number, Min = 1000000000, f, s;
cin >> number >> str >> f;
for (int c = 1; c < number; c++) {
cin >> s;
if (str[c] == 'L' && str[c - 1] == 'R') Min = min(Min, (s - f) / 2);
f = s;
}
cout << (Min < 1000000000 ? Min : -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.Scanner;
public class Ques1 {
public static void main(String[] args) {
Scanner inp=new Scanner(System.in);
int n=inp.nextInt();
inp.nextLine();
String in=inp.nextLine();
int []arr=new int[n];
for(int i=0;i<n;i++)
{
arr[i]=inp.nextInt();
}
int min=-1;
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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
string a;
cin >> a;
int Arr[N];
for (int i = 0; i < N; i++) {
cin >> Arr[i];
}
int R = 10000000009;
bool done = false;
for (int i = 0; i < N; i++) {
if (a[i] == 'R' && a[i + 1] == 'L') {
R = min(R, (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 |
def main():
n = int(input())
d = input()
x = list(map(int, input().split()))
t = -1
for i in range(len(x) - 1):
if d[i] == 'R' and d[i+1] == 'L':
time = (x[i] + x[i+1]) // 2 - x[i]
t = min(1e10 if t < 0 else t, time)
print(t)
if __name__ == '__main__':
main() | 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())
a=input()
b=input()
b=b.split()
x=0-1
for i in range(N-1):
if a[i]=='R' and a[i+1]=='L':
m=(int(b[i+1])-int(b[i]))//2
if x == -1:
x=m
else:
x = min(x, m)
print(x)
| 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 N = 2e5 + 5;
const int INF = 1e9 + 7;
struct node {
int pos;
char c;
} p[N];
int main() {
int n;
scanf("%d", &n);
getchar();
for (int i = 0; i < n; i++) scanf("%c", &p[i].c);
for (int i = 0; i < n; i++) scanf("%d", &p[i].pos);
int minm = INF;
for... | 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 | # Description of the problem can be found at http://codeforces.com/problemset/problem/699/A
n = int(input())
d = input()
l_d = list(map(int, input().split()))
p_R = int(1e10)
p_L = int(1e10)
m_t = int(1e10)
for i in range(n):
if d[i] == "R":
p_R = i
if d[i] == "L":
p_L = i
if p_R != ... | PYTHON3 |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | l=lambda:map(int,raw_input().split())
n=input()
s=raw_input()
a=l()
d=[]
i=0
while i<n:
if s[i:i+2]=='RL':
d.append(a[i+1]-a[i])
i+=1
if d:
print min(d)/2
else:
print -1 | PYTHON |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class LaunchOfCollider {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
... | JAVA |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
char s[200005];
int a[200005];
int main() {
int n;
int minn = INT_MAX;
scanf("%d", &n);
getchar();
for (int i = 0; i < n; i++) {
scanf("%c", &s[i]);
}
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
for (int i = 0; i < n; i++) {
if (s[i] ==... | CPP |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | n = int(input())
i = input()
x = input().split(" ")
cr = []
for a in range(len(x)):
x[a] = int(x[a])
a = 0
while(a < n-1):
if(i[a] == "R"):
if(i[a+1] == "L"):
cr.append((x[a+1]-x[a])//2)
a += 2
else:
a += 1
else:
a += 1
if(len(cr) > 0):
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;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int a[n], i, j, k, cnt = 1e9, tmp = 0;
for (i = 0; i < n; i++) cin >> a[i];
for (i = 0; i < s.size() - 1; i++) {
if (s[i] == 'R' && s[i + 1] == 'L') {
tmp = (a[i + 1] - a[i]) / 2;
if (tmp < cnt)... | CPP |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
char s[200000 + 5];
int a[200000 + 5];
int main() {
int n;
while (~scanf("%d", &n)) {
scanf("%s", s);
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
int minn = 1000000000, flag = 0;
for (int i = 0; i < n; i++) {
if (s[i] == 'R' && s[i + 1] == 'L')... | CPP |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | import java.util.Scanner;
public class JavaApplication30 {
private static Scanner in=new Scanner(System.in);
public static void main(String[] args) {
int num=in.nextInt(); in.nextLine();
String s=in.nextLine();
int list[]=new int[num];
int sum=1000000000;
for(int i=0;i<nu... | 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()
arr=[int(i)for i in input().split()]
li=[arr[i+1]-arr[i] for i in range(n-1) if s[i]=='R'and s[i+1]=='L']
if li:
ans=min(li)//2
print(ans)
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;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
string s;
cin >> n >> s;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int ans = 1e9;
for (int i = 0; i < n - 1; i++) {
if (s[i] == 'R' && s[i + 1] ==... | 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);
cin.tie(NULL), cout.tie(NULL), cout.precision(15);
int N;
cin >> N;
string s;
cin >> s;
int res = 1e9 + 100;
bool f = false;
int prev = -1, cur = -1;
for (int i = 0; i < N; i++) {
if (i == 0)
cin >> pre... | 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;
void solve() {
int n;
cin >> n;
string s;
cin >> s;
vector<long long> v(n);
for (int i = 0; i < n; i++) cin >> v[i];
long long ans = LONG_MAX;
for (int i = 0; i < n - 1; i++) {
if (s[i] == 'R' && s[i + 1] == 'L') ans = min(ans, (v[i + 1] - v[i]) / 2);
... | CPP |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | 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 Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner SC=new Scanner(System.in);
BufferedReader br=new BufferedReader(new InputStr... | 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 a[n];
for (int i = 0; i < n; i++) cin >> a[i];
int ans = 1e9;
for (int i = 0; i < n - 1; i++)
if (s[i] == 'R' && s[i + 1] == 'L') ans = min(ans, (a[i + 1] - a[i]) / 2);
if (ans == 1e9)
cout << -... | 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()))
res=[a[i+1]-a[i] for i in range(n-1) if s[i]=='R' and s[i+1]=='L']
if(res):
print(int(min(res)/2))
else: print(-1)
# Made By Mostafa_Khaled | 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())
ds = input()
tl = list(map(int,input().split()))
ans=[tl[i+1]-tl[i] for i in range(n-1) if ds[i]=="R" and ds[i+1]=="L"]
if len(ans)>0:
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())
drctn = list(input())
pos = list(map(int, input().split()))
time = set()
for i in range(n - 1):
if drctn[i] == 'R' and drctn[i + 1] == 'L':
time.add((pos[i + 1] - pos[i]) // 2)
if len(time) > 0:
print(min(time))
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 = input()
n = int(n)
s = input()
num = input()
num = list((num.split(' ')))
if n is 1:
print(-1)
exit()
ans = 0x3f3f3f3f
for i in range(n-1):
if s[i] is 'R' and s[i+1] is 'L':
ans = min((int(num[i+1])-int(num[i]))//2,ans)
if ans is 0x3f3f3f3f:
print(-1)
else:
print(ans)
| PYTHON3 |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | import java.util.*;
import java.io.*;
public class R699A {
FastScanner in;
PrintWriter out;
void solve() {
int n=in.nextInt();
String s=in.next();
int[] x = new int[n];
int ans=Integer.MAX_VALUE;
for(int i=0; i<n; i++) {
x[i]=in.nextInt();
if... | 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 OO = 1e8;
const double EPS = (1e-7);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
const int N = 100;
bool adjMatrixBool[N][N];
int adjMatrix[N][N];
vector<int> adjMatrixAll[N][N];
map<pair<int, int>, int> adjMatrixMap;
vec... | 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())
dir = raw_input()
s= raw_input()
l = s.split()
flag =0
res =[]
for i in range(len(dir)-1):
if dir[i] == 'R' and dir[i+1]=='L':
flag =1
res.append((int(l[i+1])-int(l[i]))/2)
res.sort()
if flag:
print res[0]
else:
print -1
... | PYTHON |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | n = int(raw_input())
directions = raw_input()
positions = map(int, raw_input().split())
result = -1
for i in xrange(0, n - 1):
if directions[i] == 'R' and directions[i + 1] == 'L':
if result == -1:
result = (positions[i + 1] - positions[i]) / 2
else:
result = min(result, (po... | PYTHON |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | n=int(input())
s=input()
a=list(map(int,input().split()))
#print(a)
ans=-1
for i in range(1,n):
if s[i-1]=='R' and s[i]=='L':
ans=(min(ans,(a[i]-a[i-1])//2) if ans>=0 else (a[i]-a[i-1])//2)
print(ans) | PYTHON3 |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
char A[1000013];
long long B[1000013];
int main() {
long long n;
cin >> n;
char t;
long long j;
for (long long i = 0; i < n; i++) {
cin >> t;
A[i] = t;
}
for (long long i = 0; i < n; i++) {
cin >> j;
B[i] = j;
}
long long min = 100000000000... | 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()
m=raw_input()
a=map(int,raw_input().split())
ans = -1
for i in range(n-1):
if m[i] == 'R' and m[i+1] == 'L':
x = (a[i+1]-a[i])/2
if ans == -1:
ans = x
else:
ans = min(ans,x)
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 | x = input()
d = raw_input()
cor = map(int, raw_input().split())
ans = -1
r = 0 if d[0] == 'R' else -1
for i in xrange(1, x):
curr_t = -1
if d[i] == 'L':
if r != -1:
curr_t = (cor[i] - cor[r]) / 2
else:
r = i
if curr_t != -1:
ans = curr_t if ans == -1 else 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;
int main() {
int n, a[200000], b[200000], x = 0;
cin >> n;
char s[200000];
cin >> s;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; s[i] != '\0'; i++) {
if (s[i] == 'R' && s[i + 1] == 'L') {
b[x] = a[i + 1] - a[i];
x++;
}
... | 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 f = 1378;
int main() {
int n, k = 0, c = 1000000000;
cin >> n;
string g;
cin >> g;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
if (g[i] == 'R' && g[i + 1] == 'L') {
k = a[i + 1] - a[i];
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, = map(int, input().split())
d = input()
arr = list(map(int, input().split()))
ans = float("inf")
for i in range(1, n):
if d[i] == 'L' and d[i - 1] == 'R':
ans = min(ans, (arr[i] - arr[i - 1]) // 2)
print(ans if ans < float("inf") else -1)
| PYTHON3 |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | n=int(input())
dir=input()
l=list(map(int,input().split()))
min=max(l)
f=0
for i in range(n-1):
if(dir[i]=='R' and dir[i+1]=='L'):
f=1
a=(l[i+1]-l[i])//2
if(a<min):
min=a
if(f==0):
print(-1)
else:
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 | #include <bits/stdc++.h>
using namespace std;
int mx = 1e9;
int main() {
int a[200005];
string s;
int n, res = 1e9;
cin >> n;
cin >> s;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n - 1; i++) {
if (s[i] == 'R' && s[i + 1] == 'L') {
res = min(res, (a[i + 1] - a[i]) / 2);
}
... | CPP |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | n=int(input())
s=input()
x=list(map(int,input().split()))
p=sorted([(x[i],s[i]) for i in range(n)])
ans=-1
mi=10**10
for i in range(1,n):
if p[i-1][1]=='R' and p[i][1]=='L' and p[i][0]-p[i-1][0]<mi:
mi=p[i][0]-p[i-1][0]; ans=mi//2
print(ans) | PYTHON3 |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | import java.io.*;
import java.util.*;
public class Main {
public void solve() throws IOException {
int n = nextInt();
String directions = next();
int x[] = new int [n];
for (int i = 0 ; i < n ; i++) {
x[i] = nextInt();
}
int ans = 1 << 30;
for (... | 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()
c=[int(x) for x in input().split()]
l=[]
f=0
for i in range(len(s)-1):
if s[i]=='R' and s[i+1]=='L':
med=(c[i]+c[i+1])/2
l.append(abs(med-c[i]))
f=1
l=sorted(l)
if f==1:
print(int(l[0]))
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())
dir = input()
dist = [int(x) for x in input().split()]
sz = len(dir) - 1
time = -1
for i in range(sz):
if dir[i] == 'R' and dir[i+1] == 'L':
x = int((dist[i+1] - dist[i]) / 2)
if time == -1 or x < time:
time = x
print(time) | PYTHON3 |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 |
import java.io.*;
import java.util.*;
public class Code {
static InputReader in = new InputReader(System.in);
public static void main(String[] args) {
//Scanner in = new Scanner(System.in);
int n = in.nextInt();
String p = in.nextLine();
int[] d = new int[n];
for (in... | 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 | '''input
2
RL
0 1000000000
'''
n = int(input())
d = input()
x = list(map(int, input().split()))
if "RL" in d:
m = 10000000000000000
for i in range(n-1):
if d[i:i+2] == "RL":
m = min(m, x[i+1] - x[i])
print(m//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(raw_input())
astr = raw_input()
har = map(int,raw_input().split())
ans = 10**9+7
for i in xrange(1,n):
if astr[i-1] == 'R' and astr[i] == 'L':
ans = min(ans,abs(har[i] - har[i-1])/2)
print -1 if ans == 10**9+7 else 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 | import java.io.*;
import java.util.*;
public class A {
static class Pair implements Comparable<Pair>{
int num ;
char dir;
Pair (int n , char d){
num = n;
dir = d;
}
@Override
public int compareTo(Pair pair) {
return num == pai... | JAVA |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | //package codeforces;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
public class main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n=in.nextInt();
String x=in.next();
int ans=(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 | n = int(input())
dirct = input()
cord = list(map(int, input().split()))
ans = [cord[i+1] - cord[i] for i in range(n-1) if dirct[i] == 'R' and dirct[i+1] == 'L']
print(min(ans)//2) if len(ans) > 0 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()
l=list(map(int,input().split()))
ma=10000000000
for i in range(1,n) :
if S[i-1]=='R' and S[i]=='L' :
if ma>abs(l[i]-l[i-1])//2 :
ma=abs(l[i]-l[i-1])//2
if ma==10000000000 :
print(-1)
else :
print(ma)
| 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())
st = input()
a = [int(i) for i in input().split()]
for i in range(n-1):
if(a[i]==a[i+1]):
print(0)
exit(0)
ans = 10**9
for i in range(n-1):
if st[i]=='R' and st[i+1]=='L': ans = min(ans,(a[i+1]-a[i])//2)
if ans!=10**9: print(ans)
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;
int main() {
long long n;
string s;
vector<long long> v;
cin >> n;
cin >> s;
int z;
for (long long i = 0; i < n; i++) {
cin >> z;
v.push_back(z);
}
bool col = false;
vector<int> diff;
int x;
int ind = find(v.begin(), v.end(), 'R') - v.end();
... | 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 Main {
public static void main (String args[])
{
Scanner sc = new Scanner (System.in);
int n = sc.nextInt();
String word =sc .next();
long arr[] = new long[n];
long count[] = new long[n];
int x=0;
if(n>1)
{
for(int i=0; i<n;i++)
{
arr[i] =sc.nextLong();
}
// ... | 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.Scanner;
public class ColliderLaunch {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int testCases = scanner.nextInt();
String input = scanner.next();
int[] coordinates = new int[testCases];
coordinates[0] = scanner.n... | JAVA |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | n = int(input())
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+1-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.*;
public class launchofcollider
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int n=Integer.parseInt(in.nextLine());
String str=in.nextLine();
int a[]=new int[n];
int i,diff=0,min=Integer.MAX_VALUE;
String s[]=in.... | JAVA |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 |
n=int(input())
t=input()
arr1=list(map(int,input().split()))
ans=[arr1[i+1]-arr1[i] for i in range(n-1) if (t[i]=='R' and t[i+1]=='L')]
if ans:
print(min(ans)//2)
else:
print('-1')
| PYTHON3 |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | import java.util.*;
import java.io.*;
public class LaunchofCollider
{
/************************ SOLUTION STARTS HERE ***********************/
private static void solve(FastScanner s1, PrintWriter out){
int N = s1.nextInt();
String seq = s1.nextLine();
int arr[] = s1.nextIntArray(N);
int lastLeft ... | 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.Scanner;
import java.util.TreeSet;
public class LaunchOfCollider {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = sc.next();
int[] a = new int[n];
for(int i = 0; i < n; i++) a[i] = sc.nextInt();
sc.close();
TreeSet<Integer> ... | JAVA |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int n;
char dir[200047];
long long l[200047];
int main() {
scanf("%d", &n);
scanf("%s", dir);
for (int i = 0; i < n; i++) scanf("%lld", l + i);
long long ans = -1;
for (int i = 0; i < n - 1; i++)
if ((dir[i] == 'R') && (dir[i + 1] == 'L')) {
if (ans == -... | 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 Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
String inp = sc.nextLine();
String [] crap = sc.nextLine().split(" ");
int [] arr = new int [n];
//int [] dir = new int [n];
for... | 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 math
N = int(input())
directions = [x for x in input().split()]
speeds =[int(x) for x in input().split()]
min = 1000000000
found = 0
for x in range(0,len(directions[0])-1):
# print(directions[0][x])
if directions[0][x]=="R" and directions[0][x+1]=="L":
time = (speeds[x+1]-speeds[x])/2
#print(time)
if time... | PYTHON3 |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | n=int(input())
s=input()
a=list(map(int, input().split()))
ans=2**40
for i in range(1, n):
if s[i-1]=='R' and s[i]=='L':
ans=min(ans, a[i]-a[i-1])
print(-1 if ans==2**40 else ans>>1) | PYTHON3 |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Main {
public static void main(String[] args) {
Scanner s1=new Scanner(System.in);
int n;
n=s1.nextInt();
String h=s1.next();
int[] arr=new int[n];
for(in... | JAVA |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | import sys
n = int(input())
d = input()
x = list(map(int, input().split()))
r = 0
l = 0
m = sys.maxsize
while True:
r = d.find('R', l)
if r == -1:
break
l = d.find('L', r + 1)
if l == -1:
break
r = l - 1
if m > (x[l] - x[r]) // 2:
m = (x[l] - x[r]) // 2
if m == sys.maxsize:
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;
int main() {
int n, i = 0, d, c = 0, cd = 1000000000;
cin >> n;
string s;
cin >> s;
vector<int> a(n);
while (i < n) {
cin >> a[i];
i++;
}
i = 0;
while (i < n - 1) {
if ((s[i] == 'R') && (s[i + 1] == 'L')) {
d = a[i + 1] - a[i];
c++;... | CPP |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | from sys import stdin
inf=1000*1000*1000
n=int(input())
directions=stdin.readline()
depart=list(map(int,stdin.readline().split()))
tempsMin=inf
for i in range(n-1):
direction=directions[i]
directionApres=directions[i+1]
temps=(depart[i+1]-depart[i])//2
if direction=="R" and directionApres=="L":
tempsMin=min(temp... | PYTHON3 |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | def inp():
return(int(input()))
def inlt():
return(list(map(int,input().split())))
def insr():
s = input()
return(list(s[:len(s) - 1]))
def invr():
return(map(int,input().split()))
def loadinput():
n = int(input())
di = list(str(input()))
vals =list(map(int,input().split()))
return ... | 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())
d=input()
p=input().split(' ')
if 'RL' not in d: print (-1)
else:
l=0
c=1000000000
while 'RL' in d[l:]:
l=d[l:].index('RL')+l
if ( int(p[l+1]) - int(p[l]) )/2<c:
c=(int(p[l+1])-int(p[l]))/2
l+=2
print (int(c))
| PYTHON3 |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | n = int(raw_input())
s = raw_input()
p = [int(x) for x in raw_input().split()]
r = 0
l = 0
ans = -1
while r <n:
while(r < n and s[r] != 'R' ) :
r+=1
if (l <= r):
l = r+1
while(l < n and s[l] != 'L'):
l+=1
if l==n or r == n: break
if (ans == -1) or (p[l]-p[r])/2 < 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 | import java.io.*;
import java.util.*;
public class TaskA {
public static void main (String[] args) throws IOException {
FastScanner fs = new FastScanner(System.in);
PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));
int n = fs.nextInt();
String s = fs.reader.readLine();
int t = 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 | #include <bits/stdc++.h>
using namespace std;
char s[200010];
int a[200010];
int main() {
int n, i, j, k;
scanf("%d", &n);
scanf("%s", s);
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
int mi = 2e9;
int len = strlen(s);
for (i = 0; i < len - 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int ans = -1;
for (int i = 0; i < n - 1; ++i) {
if (s[i] == 'R' && s[i + 1] == 'L') {
int temp = (a[i + 1] - a[i]) / 2;
if (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())
s=input()
lt=list(input().split())
l=len(lt)-1
mn=10**10
for i in range(l):
if s[i]=='R' and s[i+1]=='L':
a=int(lt[i+1])-int(lt[i])
if a<mn:
mn=a
if mn==10**10:
print(-1)
else:
print(math.ceil(mn/2))
| PYTHON3 |
699_A. Launch of Collider | There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the dista... | 2 | 7 | n = int(input())
d = input()
p = list(map(int,input().split()))
m=max(p)
f=0
for i in range(n-1):
if(d[i]=='R' and d[i+1]=='L'):
s=(p[i]+p[i+1])//2 - p[i]
if(s<m):
m=s
f=1
if(f==0):
print(-1)
else:
print(m) | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.