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 |
|---|---|---|---|---|---|
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import com.sun.corba.se.spi.orb.ParserImplBase;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
/**
* Created with IntelliJ IDEA.
* User: AUtemuratov
* Date: 07.04.14
* Time: 15:43
* To change this template use File | Settings | File Templates.
*/... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
long long tpp = 9e18;
int tp = 1e9;
long long n, m, s, f, t, d, l, r, prev = 0;
string Q;
char ch;
vector<int> a;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m >> s >> f;
if (s < f) {
ch = 'R';
d = 1;
} else {
ch =... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | n, m, s, f = map(int, input().split())
if s < f:
d = 1
c = 'R'
else:
d = -1
c = 'L'
res = ''
i, j = 1, s
t, l, r = map(int, input().split())
k = 1
while j != f:
if i > t and k < m:
t, l, r = map(int, input().split())
k += 1
if i == t and (l <= j <= r or l <= j + d <= r):
... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int s, f;
string ans;
void move() {
if (s == f) return;
if (s < f) {
s++;
ans += "R";
} else {
s--;
ans += "L";
}
}
int main() {
int n, m, i, t, a, b, prev;
cin >> n >> m >> s >> f;
for (prev = i = 1; i <= m; i++) {
cin >> t >> a >> b;
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
const long long mod = 1000000007;
const double pi = 3.1415926536;
int main() {
cin.tie(0);
std::ios::sync_with_stdio(false);
int n, m, s, f;
cin >> n >> m >> s >> f;
int step[m];
vector<pair<int, int> > rl;
s... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
vector<vector<int> > a;
int t, l, r;
vector<int> q;
for (int i = 0; i < m; ++i) {
cin >> t >> l >> r;
q.push_back(t);
q.push_back(l);
q.push_back(r);
a.push_back(q);
q.clear();
}
s... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | n, m, s, f = map(int, input().split())
if s < f:
step = "R"
step_i = 1
else:
step = "L"
step_i = -1
ans = []
tp = 0
for i in range(m):
t, l, r = map(int, input().split())
k = min(t - tp - 1, abs(f - s))
for j in range(k):
ans.append(step)
s += step_i * k
if s == f:
pr... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
struct node {
int t;
int x;
int y;
} tt[maxn];
int main() {
int n, m, s, f;
while (~scanf("%d%d%d%d", &n, &m, &s, &f)) {
memset(tt, 0, sizeof tt);
for (int i = 0; i < m; i++) {
scanf("%d%d%d", &tt[i].t, &tt[i].x, &tt[i].... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.io.*;
import java.util.*;
public class Main {
private static boolean inRange(int x, int l, int r) {
return x >= l && x <= r;
}
private static void solve(InputReader in, OutputWriter out) {
int n = in.nextInt();
int m = in.nextInt();
int s = in.nextInt();
... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import math
import sys
def main():
n, m, s, f = map(int, raw_input().split())
t = 1
xenias = []
for i in range(m):
next_t, l, r = map(int, raw_input().split())
xenias.append((next_t, l, r))
index = 0
current_spy = s
if f > s:
d = 'R'
next_spy = s + 1
else:
d = 'L'
next_spy = s -... | PYTHON |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, m, s, f;
int main() {
cin >> n >> m >> s >> f;
int t = 0, l, r;
int perv = -1;
for (int i = (0), _end = (m); i < _end; ++i) {
perv = t;
cin >> t >> l >> r;
for (int j = (0), _end = (abs(t - perv) - 1); j < _end; ++j) {
if (s < f)
put... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | n,m,s,f = map (int, input().split())
watch = {}
for i in range (m):
t,l,r = map (int, input().split())
watch[t] = (l,r)
cur = s
move,symbol = (1,'R') if s < f else (-1,'L')
step = 1
while cur != f:
if step in watch:
l,r = watch[step]
if (l <= cur <= r or
l <= (cur+move) <= r):
print ('X',end... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 |
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
public class XeniaAndSpies {
private static final char PASS_TO_LEFT = 'L';
private static final char PASS_TO_RIGHT = 'R';
private static final char KEEP_IT = 'X';
private static int numSpies;
... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 |
import java.io.*;
import java.util.StringTokenizer;
/**
* @author kperikov
*/
public class B implements Runnable {
PrintWriter out;
BufferedReader br;
StringTokenizer st;
public static void main(String[] args) throws IOException {
new Thread(new B()).start();
}
public String next(... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import sys
from itertools import *
from math import *
def solve():
n,m,s,f = map(int, input().split())
s-=1
f-=1
d = {}
for _ in range(m):
t,l,r = map(int, input().split())
d[t-1] = (l - 1, r - 1)
# d = {(t - 1) : (l - 1, r - 1) for t,l,r in map(int, input().split()) for _ in ran... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int dx8[8] = {-1, 1, 0, 0, 1, 1, -1, -1};
int dy8[8] = {0, 0, 1, -1, 1, -1, 1, -1};
void file() {}
void fast() {
std::ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
}
int check(long long x) {
long long sum = 0;
long long x1 = x;
while (x1 != 0) {
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | def prog():
inp = raw_input().split()
n = int(inp[0])
m = int(inp[1])
s = int(inp[2])
f = int(inp[3])
start = s
ans = ""
curr = 1
if(s>f):
di = "L"
step = -1
else:
di = "R"
step = 1
for ind in xrange(1,m+1):
if(start == f):
... | PYTHON |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
map<int, pair<int, int> > T;
int main() {
int N, M, S, F;
scanf("%d%d%d%d", &N, &M, &S, &F);
for (int i = 0; i < M; i++) {
int A, B, C;
cin >> A >> B >> C;
T[A].first = B;
T[A].second = C;
}
int step = 1;
int cur = S;
while (true) {
if (cur... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | n, m, s, f = [int(x) for x in input().split()]
now = 1
d = 1 if f > s else -1
step = 'R' if d == 1 else 'L'
ret = ""
for _ in range(m):
t, l, r = [int(x) for x in input().split()]
if t > now:
flag = False
while t > now:
s += d
ret += step
now += 1
... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | n, m, s, f = map(int, input().split())
l = []
for i in range(m):
t, c,r = map(int, input().split())
l.append([t, c, r])
if s > f:
st = ""
t = 1
i = 0
while(i<m):
if t == l[i][0]:
if (s<l[i][1] or s>l[i][2]) and (s-1<l[i][1] or s-1>l[i][2]):
s-=1
... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.util.Scanner;
public class C_199_D2_B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int s = sc.nextInt();
int f = sc.nextInt();
int[][] a = new int[m][3];
for (int i = 0; i < m; i++) {
for (int j = 0; j ... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
int main() {
int n, m, s, f;
scanf("%d %d %d %d", &n, &m, &s, &f);
int ct = 1;
while (m--) {
int t, l, r;
scanf("%d %d %d", &t, &l, &r);
while (ct < t && s != f) {
if (s < f) {
printf("R");
s++;
} else {
printf("L");
s--;
}
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
vector<long long int> prm(1000010, 1);
long long int P = 1e9 + 7;
long long int M = 998244353;
char adjlist[1001][1001];
bool visited[1000001] = {false};
long double pi = 3.14159265358979323846264338327950;
map<int, int> visit;
map<int, set<int>> g;
int cc = 0;
vector<pair<... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.io.InputStreamReader;
import java.io.IOException;
import java.util.HashMap;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author na... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
public static void main(String[] args) throws IOException
{
//Locale.setDefault (Locale.US);
Reader in = new Reader();
StringBuilder out = new StringBuilder();
int n, m, s, f, t, l , r, curr, mv;
char cr;... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct c_istream {
c_istream operator>>(int &n) {
scanf("%i", &n);
return *this;
}
c_istream operator>>(char &c) {
scanf("%c", &c);
return *this;
}
c_istream operator>>(double &d) {
scanf("%lf", &d);
return *this;
}
};
struct c_ostream {
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.util.Scanner;
public class XeniaAndSpies {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int spiesCount = scanner.nextInt();
int watchMovesCount = scanner.nextInt();
int fromSpy = scanner.nextInt() - 1;
int toSpy = scanner.n... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.awt.image.BufferedImage;
import java.io.*;
import java.util.*;
import java.util.concurrent.ExecutionException;
public class Main {
public void Run() {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
int s = in.nextInt();
int f... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T sqr(T n) {
return (n * n);
}
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
int add = 1;
char c = 'R';
if (s > f) {
add = -1;
c = 'L';
}
int t, l, r;
int tim = 1;
string res;
bool found = false;
for (int ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 1e18;
const int N = 121234;
const int mod = 100000007;
const int M = 5241234;
int n, m, s, f;
struct Node {
int t, l, r;
} xx[N];
int ans[M];
int main() {
while (scanf("%d%d%d%d", &n, &m, &s, &f) != EOF) {
int i, j;
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct triple {
int t, l, r;
};
void move(int& s, int& f, string& out) {
if (s < f)
s++, out += "R";
else
s--, out += "L";
}
int next(int s, int f) {
if (s < f)
return s + 1;
else
return s - 1;
}
int main() {
int n, m, s, f;
cin >> n >> m >> s ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | 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 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.util.*;
import java.io.*;
public class CF1 implements Runnable {
static FastReader sc;
static PrintWriter out;
static int mod = 1000000007, inf = (int) 1e9, minf = -(int) 1e9;
static long infL = (long) 1e18, minfL = -(long) 1e18;
public static void main(String[] args) {
new Th... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
int k = 0;
int t[m], l[m], r[m];
for (int i = 0; i < m; i++) {
cin >> t[i] >> l[i] >> r[i];
}
int pos = s;
if (s < f) {
for (int time = 1; time <= 2 * n + 2 * m; time++) {
if (k < m && time ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int espies;
int vigies;
int origen;
int desti;
int t;
int l;
int r;
int tmax = 1000000000;
int pas;
cin >> espies >> vigies >> origen >> desti;
cin >> t >> l >> r;
for (int i = 1; i <= tmax; i++) {
if (origen == desti) {
break;... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | R = lambda: map(int, input().split())
n, m, s, f = R()
if s < f:
d = 1
c = 'R'
else:
d = -1
c = 'L'
res = ""
i = 1
j = s
t, l, r = R()
k = 1
while j != f:
if i > t and k < m:
t, l, r = R()
k += 1
if i == t and (l <= j <= r or l <= j + d <= r):
res += 'X'
else:
res += c
j += d
i +... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | """
Template written to be used by Python Programmers.
Use at your own risk!!!!
Owned by enraged(rating - 5 star at CodeChef and Specialist at Codeforces).
"""
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, ... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
map<int, int> l, r;
int main() {
string ans = "";
int n, m, s, f, j, a, b;
cin >> n >> m >> s >> f;
for (int i = 1; i <= m; i++) {
cin >> j >> a >> b;
l[j] = a;
r[j] = b;
}
for (int i = 1;; i++) {
if (s == f) break;
if (s < f) {
if (l[i... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
int num[8];
int main() {
int n, m, s, t, c, a, b, pre = 0;
scanf("%d%d%d%d", &n, &m, &s, &t);
while (m--) {
scanf("%d%d%d", &c, &a, &b);
if (s < t) {
while (pre < c - 1 && s != t) {
putchar('R');
s++;
pre++;
}
if (s == t) break;
pre+... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class XeniaSpies2 {
public static int n;
public static int m;
public static int s;
public static int f;
public static void start(int[][] numbers) {
StringBuilder result = new StringBuilder();
int counter = 0;
... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.util.HashSet;
import java.util.*;
import java.util.Scanner;
import java.util.Set;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.text.DecimalFormat;
import java.lang.Math;
public class Main{
public static void main(String[] args){
Sc... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.util.Scanner;
public class B {
public static void main(String arg[]) {
Scanner reader = new Scanner(System.in);
int n = reader.nextInt();
int m = reader.nextInt();
int s = reader.nextInt();
int f = reader.nextInt();
int a[][] = new int[m][3];
f... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | n, m, s, f = map(int, raw_input().split())
a = []
ans = ""
t = 1
d = 1 if s < f else -1
for q in xrange(m):
a = map(int, raw_input().split())
while a[0] > t and s != f:
ans += "R" if d == 1 else "L"
s += d
t += 1
if s == f:
break
if a[1] <= s <= a[2] or a[1] <= s + d <= a[2]:
ans += "X"
else:
ans += "R... | PYTHON |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import static java.lang.System.out;
public class CF199B {
private int s,f;
private StringBuilder res = new StringBuilder("");
public void init(int s, int f) {
this.s=s;
... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int powmod(int a, int b, int p) {
int res = 1;
while (b)
if (b & 1)
res = int(res * 1ll * a % p), --b;
else
a = int(a * 1ll * a % p), b >>= 1;
return res;
}
int generator(int p) {
vector<int> fact;
int phi = p - 1, n = phi... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
public class CF199B {
private static class Pair {
int l;
int r;
public Pair(final int le, final int ri) {
l = le;
r = ri;
... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | def checkKey(dict, key):
if key in dict:
return True
return False
# def helper(s):
# l=len(s)
# if (l==1):
# l=[]
# l.append(s)
# return l
# ch=s[0]
# recresult=helper(s[1:])
# myresult=[]
# myresult.append(ch)
# for st in recresult:
# myresult.append(st)
# ts=ch+st
# myresult.append(ts)
# ret... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
char pos[] = "XLR";
int inc, c;
int abs(int a) { return (a < 0) ? (0 - a) : a; }
int main() {
int n, m, s, f;
scanf("%d %d %d %d", &n, &m, &s, &f);
if (s < f) {
inc = 1;
c = 2;
} else {
inc = -1;
c = 1;
}
int to = 1, t, l, r, a;
for (int i = 0; i < m; i++) {
sc... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
const double pi = 3.141592653589793238462;
const double eps = 1e-10;
using namespace std;
const int maxn = 100010;
int t[maxn], l[maxn], r[maxn];
int main() {
int i, j, k, n, m, tc, s, f;
ios_base::sync_with_stdio(false);
cin >> n >> m >> s >> f;
for (i = 0; i < m; i++) cin >> t[i] >> l... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
int mark[100005];
struct node {
int x, y;
int id;
} a[100005];
int main() {
int n, m, s, f;
while (scanf("%d%d%d%d", &n, &m, &s, &f) != EOF) {
memset(mark, 0, sizeof(mark));
int i, k, x, y;
for (i = 1; i <= m; i++) scanf("%d%d%d", &a[i].id, &a[i].x, &a[i].y);
a[i].id = 9... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.util.*;
import java.io.*;
public class Main {
static BufferedReader reader
= new BufferedReader(new InputStreamReader(System.in));
static StringBuilder out = new StringBuilder();
public static void main(String[] args){
int[] inp = nextIntArray();
int n, m, s, f;
... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class B {
public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine());
int n = ... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
int n, m, s, f, v;
int qry[100002][3];
int main() {
scanf("%d%d%d%d", &n, &m, &s, &f);
if (s < f) {
v = 1;
} else {
v = -1;
}
for (int i = 0; i < m; i++) {
scanf("%d%d%d", &qry[i][0], &qry[i][1], &qry[i][2]);
}
int nxt = 0;
int tm = 1;
while (s != f) {
if (nxt ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
out << '(' << p.first << ", " << p.second << ')';
return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
long long l = v.size();
for (long... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, m, s, f;
map<int, pair<int, int> > a;
bool ok(int i, int x) {
pair<int, int> u = a[i];
if (s < f)
return x < u.first - 1 || x > u.second;
else
return x > u.second + 1 || x < u.first;
}
int main() {
scanf("%d%d%d%d", &n, &m, &s, &f);
for (int i = 1; ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct xx {
int s;
int l;
int r;
};
xx a[100005];
int xp, kt, n, m;
int check1(int xp, int step) {
if (xp >= a[step].l && xp <= a[step].r) return 0;
if (xp + 1 >= a[step].l && xp + 1 <= a[step].r) return 0;
return 1;
}
int check2(int xp, int step) {
if (xp >= ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long i, j, k, l, m, n, s, f;
cin >> n >> m >> s >> f;
long long curr = s, dest = f;
vector<vector<long long> > req;
for (i = 0; i < m; i++) {
long long a, b, c;
cin >> a >> b >> c;
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long pw(long long b, long long e, long long m) {
long long r = 1;
b = b % m;
while (e > 0) {
if (e & 1) r = (r * b) % m;
e >>= 1;
b = (b * b) % m;
}
return r;
}
int n... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | n, m, s, f = map(int, raw_input().split(" "))
curr = s
ct = 1
ans = ""
for i in range(m):
t, l, r = map(int, raw_input().split(" "))
while ct < t and curr != f:
if s < f:
curr += 1
ans += "R"
else:
curr -= 1
ans += "L"
ct += 1
if curr == f:
break
else:
if l <= curr and curr <= r:
ans += "X"... | PYTHON |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.util.*;
import java.math.*;
public class Main {
static void append(StringBuilder builder, char c, int count) {
for (int i = 0; i < count; i++) {
builder.append(c);
}
}
public static void main(String[] args) throws Exception {
Scanner scan = new Scan... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
# from fractions import *
# from heapq import*
from bisect import *
from io import BytesIO, IOBase
def vsInput():
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | // practice with rainboy
import java.io.*;
import java.util.*;
public class CF342B extends PrintWriter {
CF342B() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF342B o = new CF342B(); o.main(); o.flush();
}
void main() {
int n = sc.nextInt();
int m... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
long long n, m, s, f, z, cnt = 1;
map<int, int> l, r;
string ans;
int main() {
cin >> n >> m >> s >> f;
for (int i = 1; i <= m; i++) {
cin >> z;
cin >> l[z] >> r[z];
}
while (s != f) {
if (s > f) {
if (l[cnt] > s || r[cnt] < s - 1) {
s--;
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.io.*;
import java.io.PrintWriter;
import java.util.*;
import java.io.InputStream;
import java.io.DataInputStream;
public class Main
{
//static{ System.out.println("hello");}
static InputStream inputStream = System.in;
static OutputStream outputStream = System.out;
static FastR... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import sys
from itertools import *
from math import *
def solve():
n,m,s,f = map(int, input().split())
s-=1
f-=1
d = {}
for _ in range(m):
t,l,r = map(int, input().split())
d[t-1] = (l - 1, r - 1)
# d = {(t - 1) : (l - 1, r - 1) for t,l,r in map(int, input().split()) for _ in ran... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 100100;
int t[N], l[N], r[N];
char str[N << 2];
int main() {
int n, m, s, f, i;
scanf("%d%d%d%d", &n, &m, &s, &f);
for (i = 0; i < m; i++) scanf("%d%d%d", &t[i], &l[i], &r[i]);
t[m] = 2000000000;
int step = (f > s) ? 1 : -1, now = s, time = 1, len = ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m, s, f, l = 1;
cin >> n >> m >> s >> f;
string q;
for (int i = 0; i < m; i++) {
int t, a, b;
cin >> t >> a >> b;
if (s != f) {
for (int j = l; j < t; j++) {
if (f > s) {
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<char> v;
int n, m, s, f, t, a, b, k, cnt = 1;
char c, x = 'X';
cin >> n >> m >> s >> f;
if (s < f) {
k = 1;
c = 'R';
} else {
k = 0;
c = 'L';
}
for (int i = 1; i <= m; i++) {
cin >> t >> a >> b;
if (s != f) {
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | n,m,s,f=map(int,input().split())
t={}
step=1
ans=''
if s<f:sig='R'
else :sig='L'
for i in range(m):
t0,l0,r0=map(int,input().split())
t[t0]=[l0,r0]
for i in range(1,n+m+1):
if s<f:
u=s+1
else:u=s-1
if i in t:
if (t[i][0]<=s<=t[i][1])or(t[i][0]<=u<=t[i][1]):
... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
int main() {
int n, m, s, f, i, cnt = 0, x, y, tt = 0, now;
scanf("%d%d%d%d", &n, &m, &s, &f);
if (s < f) {
now = s;
for (i = 1;; i++) {
if (i > tt && cnt < m) {
scanf("%d%d%d", &tt, &x, &y);
cnt++;
}
if (i == tt) {
if ((x <= now && now <=... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | n, m, s, f = map(int ,raw_input().split())
data = []
for i in xrange(0,m):
data.append(map(int ,raw_input().split()))
now = s
if s<f:
d = 'R'
di = 1
else:
d = 'L'
di = -1
t = 1
ans = []
data.append((10**9+1,1,n))
for i in data:
while t<i[0]:
ans.append(d)
t += 1
now += ... | PYTHON |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
int t, l, r;
string ans;
int steps = 1;
for (int i = 1; i <= m; i++) {
cin >> t >> l >> r;
while (steps != t) {
if (s == f) break;
if (s < f) {
ans += 'R';
s += 1;
} ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
int main(void) {
int n, m, s, f, c, t = 0, l, r;
scanf("%d %d %d %d", &n, &m, &s, &f);
int d = s < f ? 1 : -1;
for (c = 1; s != f; c++) {
if (c > t && m) scanf("%d %d %d", &t, &l, &r), m--;
if (c != t || (s < l || s > r) && (s + d < l || s + d > r))
s += d, putchar(d == 1 ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.io.*;
import java.util.*;
/**
* Created by Желтяков on 17.03.2017.
*/
public class app {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in/*new FileReader(new File("badsubs.in"))*/);
int n = scanner.nextInt();
int m = scanner... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long n, m, s, f;
cin >> n >> m >> s >> f;
map<int, pair<int, int> > ma;
map<int, pair<int, int> >::iterator it;
long long a, b, c;
string ans = "";
for (long long int i = 0; i <... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | n,m,s,f = map(int,raw_input().strip().split())
w = dict()
for _ in range(m):
t,l,r = map(int,raw_input().strip().split())
w[t] = l,r
if s>f:
dirc = "L"
d = -1
else:
dirc = "R"
d = 1
p = s
ans = []
t=1
while p!=f:
if t in w:
rs,re = w[t]
if (p >= rs and p<= re) or (p+d >= rs and p+d <=re):
ans.append("X"... | PYTHON |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
long n, m, s, f;
cin >> n >> m >> s >> f;
map<long long, pair<long, long> > mp;
for (long i = 1; i <= m; i++) {
long long t;
long l, r;
cin >> t >> l >> r;
mp[t] = make_pair(l, r);
}
if (s < f) {
string s1 = "";
long t = 1;
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
string u, str = "";
int n, m, s, f, a, p = 0;
cin >> n >> m >> s >> f;
if (s < f) {
u = "R";
a = 1;
} else {
u = "L";
a = -1;
}
for (int i = 0; i < m; i++) {
int t, l, r;
cin >> t >> l >> r;
while (t - p > 0)
if (... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | input_string = raw_input()
input_list = input_string.split(" ")
n = int(input_list[0])
m = int(input_list[1])
s = int(input_list[2])
f = int(input_list[3])
if s < f:
dir = 1
ch = 'R'
else:
dir = -1
ch = 'L'
pos = s
moves = []
t = []
l = []
r = []
step = 1
ind = 0
for i in range(m):
input_string =... | PYTHON |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | //-------------------------------------------------------------------------------------------------------
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Print... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
int main() {
int n, m, s, f, t = 0, l, r, now, pass;
char pr;
scanf("%d %d %d %d", &n, &m, &s, &f);
now = s;
if (f - s > 0) {
pr = 'R';
pass = 1;
} else {
pr = 'L';
pass = -1;
}
for (int i = 1; 1; i++) {
if (i > t) {
scanf(" %d %d %d", &t, &l, &r);
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class XeniaAndSpies {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTo... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int T[100000 + 5], L[100000 + 5], R[100000 + 5];
int main() {
int n, m, s, f;
scanf("%d%d%d%d", &n, &m, &s, &f);
for (int i = 0; i < m; ++i) {
scanf("%d%d%d", &T[i], &L[i], &R[i]);
}
if (s < f) {
int p = 0, cur = s;
for (int i = 1;; ++i) {
if (p ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const long long inf = 1000000000;
double Time() { return double(clock()) / double(CLOCKS_PER_SEC); }
const int N = 1000001;
int n, s, f, m;
int main() {
cin >> n >> m >> f >> s;
int j = 1;
for (int i = (int)1; i <= (int)m; i++) {
int t, l, r;
cin >> t >> l >> ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct watch {
long long l, r;
};
int main() {
int n, m, f, s, z;
cin >> n >> m >> f >> s;
map<long long, watch> mapa;
watch tmp;
for (int i = 0; i < m; i++) {
cin >> z;
cin >> tmp.l;
cin >> tmp.r;
mapa[z] = tmp;
}
if (f < s) {
int pos = ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int n, m, s, f, t, l, r, dir, prvT = 0;
cin >... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f;
int t, l, r, nw, count;
while (scanf("%d %d %d %d", &n, &m, &s, &f) == 4) {
string str;
count = 1;
map<int, pair<int, int> > v;
for (int i = 1; i <= m; i++) {
scanf("%d", &t);
scanf("%d %d", &v[t].first, &v[t].s... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
void fastInOut() {
ios_base::sync_with_stdio(0);
cin.tie(NULL), cout.tie(NULL);
}
int gcd(int a, int b) { return (b == 0 ? a : gcd(b, a % b)); }
int lcm(int a, int b) { return ((a * b) / gcd(a, b)); }
long long pw(long long b, long long p) {
if (!p) return 1;
long l... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
long long M = 1e9 + 7;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cerr.tie(0);
int n, m, s, f, l, r, a[100005], b[100005], t[100005];
cin >> n >> m >> s >> f;
for (int i = 0; i < m; i++) {
cin >> t[i] >> a[i] >> b[i];
}
int dir = 1;
if (s > ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.util.*;
import java.io.*;
/**
*
* @author alanl
*/
public class Solve {
/**
* @param args the command line arguments
*/
static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st;
static PrintWriter pr = new PrintWriter(new Buf... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int a[100010][3];
bool inside(int x, int a, int b) { return a <= x && x <= b; }
int main(int argc, char** argv) {
ios_base::sync_with_stdio(false);
int n, m, s, f;
cin >> n >> m >> s >> f;
for (int i = 0; i < m; ++i) {
cin >> a[i][0] >> a[i][1] >> a[i][2];
}
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, m, s, e;
map<int, pair<int, int> > col;
char ans[200100];
inline bool in(int k, pair<int, int> avg) {
return (avg.first <= k && k <= avg.second);
}
int main() {
scanf("%d%d%d%d", &n, &m, &s, &e);
col.clear();
int a, b, c;
for (int i = 0; i < m; i++) {
s... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | n,m,s,f = map(int,input().split())
l = []
for i in range(m):
k = list(map(int,input().split()))
l.append(k)
count = 1
ans = ''
i = 0
while i<m:
if count < l[i][0]:
if f>s:
ans+='R'*min(l[i][0] - count,f-s)
s+=min(l[i][0] - count,f-s)
count = l[i][0]
... | PYTHON3 |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
ios::sync_with_stdio(0);
cin.tie(NULL);
long long n, m, s, f;
string moves = "";
cin >> n >> m >> s >> f;
queue<pair<int, pair<int, int> > > vec;
for (int i = 0; i < m; i++) {
int t, l, r;
cin >> t >> l >> r;
vec.p... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.util.Scanner;
public class Main {
private static Scanner sc = new Scanner(System.in);
private static int m, s, f;
private static int ti, li, ri;
private static int time = 1, step = 0, next;
private static int move;
private static char act;
private static StringBuilder action = n... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
public static void main(String args[])
{
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
int m = scn.nextInt();
int s = scn.nextInt();
int f = scn.nextInt();
int i,j,time = 1;
int arr[][] = new int[m][3];
StringBuilder sb... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 |
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class _Solution implements Runnable{
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
PrintWriter out;
... | JAVA |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, m, s, f, t[100000], l[100000], r[100000], t1;
int main() {
cin >> n >> m >> s >> f;
for (int i = 0; i < m; ++i) cin >> t[i] >> l[i] >> r[i];
for (int i = 1, j = 0; s != f; ++i) {
if (i == t[j]) {
if (s < f) {
if (s > r[j] || s + 1 < l[j])
... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int const OO = (1 << 28);
int cnt[5003];
vector<pair<int, pair<int, int> > > X;
void solve(int inc, char dir, int S, int F) {
int idx = 0;
int t = 0;
while (++t && S != F) {
if (idx >= X.size() || t != X[idx].first) {
S += inc;
cout << dir;
} else ... | CPP |
342_B. Xenia and Spies | Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the ... | 2 | 8 | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.Arra... | JAVA |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.