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 | 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>
using namespace std;
int main() {
int n, m, second, first;
cin >> n >> m >> second >> first;
int t[100001][3];
for (int i = 0; i < m; i++) {
cin >> t[i][0] >> t[i][1] >> t[i][2];
}
int step = 1, cur = second, i = 0;
string res;
while (cur != first) {
if (step == t[i][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 | #include <bits/stdc++.h>
int a[100006][3];
int main() {
int n, m, s, f, dir, i;
scanf("%d%d%d%d", &n, &m, &s, &f);
if (s < f)
dir = 1;
else
dir = -1;
for (i = 0; i < m; i++) {
scanf("%d%d%d", &a[i][0], &a[i][1], &a[i][2]);
}
i = 0;
int t = 1;
while (f != s) {
if (a[i][0] == t) {
... | 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 GCC optimize("O3")
using namespace std;
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
map<int, pair<int, int> > ma;
int h = -1;
for (int i = 0; i < m; i++) {
int a, b, c;
cin >> a >> b >> c;
h = max(h, a);
ma[a] = {b, c};
}
for (int i = 1; i <= h; 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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class P342B {
public static void main(String[] args) {
InputStream inputStream = System.in;
Ou... | 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() {
cin.sync_with_stdio(false);
int n, m, s, f, ti, li, ri;
cin >> n >> m >> s >> f;
vector<pair<int, pair<int, int>>> v;
for (int i = 0; i < m; ++i) {
cin >> ti >> li >> ri;
v.push_back(make_pair(ti, make_pair(li, ri)));
}
int curt = 1, vptr ... | 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.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
public static void main(String[]args)throws IOException{
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
String x=bf.readLine();
String[]xa=x.split(" ");
int n=Integer.parseI... | 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;
int t, l, r;
int tt, now;
void deal() {
if (f > s) {
now++;
printf("R");
} else {
now--;
printf("L");
}
}
void work() {
tt = 0;
now = s;
for (int i = 0; i < m; i++) {
scanf("%d %d %d", &t, &l, &r);
if (now == f) continue;
... | 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 on_bit(int x, int pos) {
x |= (1 << pos);
return x;
}
int off_bit(int x, int pos) {
x &= ~(1 << pos);
return x;
}
bool is_on_bit(int x, int pos) { return ((x & (1 << pos)) != 0); }
int flip_bit(int x, int pos) {
x ^= (1 << pos);
return x;
}
int lsb(int x) { ... | 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, add = 0, rund = 1;
cin >> n >> m >> s >> f;
if (s < f)
add = 1;
else
add = -1;
for (int i = 0; i < m; i++) {
int t, l, r;
cin >> t >> l >> r;
while (rund < t) {
if (s == f) break;
if (add == 1)
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;
int main() {
int spies, moments, from, to;
scanf("%d %d", &spies, &moments);
scanf("%d %d", &from, &to);
int sec = 0, current = from, time, left, right;
for (int i = 0; i < (int)(moments); i++) {
sec++;
scanf("%d %d %d", &time, &left, &right);
if (curr... | 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 look {
int t, l, r;
};
look a[100000];
int n, m, s, f;
int main() {
cin >> n >> m >> s >> f;
for (int i = 0; i < m; ++i) cin >> a[i].t >> a[i].l >> a[i].r;
int curLook = 0;
for (int t = 1; s != f; ++t) {
if (curLook < m && a[curLook].t == t) {
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 | import java.util.*;
import java.io.*;
import java.math.*;
public class Q1 {
static ArrayList<Integer> adj[],adj2[];
static int color[],cc;
static long mod=1000000007;
static TreeSet<Integer> ts;
static boolean b[],visited[],possible,ans1,ans2;
static Stack<Integer> s;
static int totalnodes,colored,minc;
stat... | 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.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;
import java.util.Arrays;
import java.util.Comparator;
public class Main
{
... | 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 IEEE {
public static void main(String[] args) throws IOException {
//Scanner sc=new Scanner(System.in);
BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer ss=new StringTokenizer(r.readLine());
int n=Integer.pars... | 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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Spies
{
public static void main(String[] args) throws IOException
{
InputStreamReader a = new InputStreamReader(System.in);
BufferedReader buf = new BufferedReader(a);
String[] temp = buf.readLine().split... | 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;
void FAST() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int Rselect(vector<int>&, int, int, int);
int partition(vector<int>&, int, int);
void scanc(vector<char>& v, long long n) {
for (int i = 0; i < n; i++) {
char num;
cin >> num;
v.push_back(... | 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, st, ed, dir, ok;
int te[100005], lf[100005], rt[100005];
int main() {
scanf("%d%d%d%d", &n, &m, &st, &ed);
for (int i = (0); i < (m); i++) scanf("%d%d%d", &te[i], &lf[i], &rt[i]);
for (int i = 1, j = 0; st != ed; i++) {
while (j < m && te[j] < 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;
int main() {
vector<bool> v;
vector<int> ans;
int n, t, s, f, a, b, c, curs = 1, curr;
scanf("%d%d%d%d", &n, &t, &s, &f);
curr = s;
if (s < f) {
while (t--) {
scanf("%d%d%d", &a, &b, &c);
if (curr == f) continue;
if (curs < a) {
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 | #include <bits/stdc++.h>
using namespace std;
const int M = 1000000000 + 7;
const double eps = 1e-10;
struct node {
int t, l, r;
} num[100005];
int cmp(node a, node b) { return a.t < b.t; }
char ans[1000005];
int main() {
int n, m, s, f;
while (~scanf("%d %d %d %d", &n, &m, &s, &f)) {
for (int i = 1; i <= m; ... | 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 n, m, s, f;
int t, x, y;
int step;
int main() {
scanf("%d %d %d %d", &n, &m, &s, &f);
step = 1;
int temp;
for (int i = 0; i < m; i++) {
temp = s;
scanf("%d %d %d", &t, &x, &y);
while (step != t) {
step++;
if (temp == f) {
printf("\n");
return ... | 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.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class XeniaSpecies implements Runnable {
static class State {
int t, a, b;
public State(int t, int a, int b) {
this.t = t;
this.a... | 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 co;
int arp[100004];
int non;
int main(int argc, char const* argv[]) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n, m, s, f;
cin >> n >> m >> s >> f;
long long a[m][3];
for (int i = 0; i < m; i++) {
cin >> a[i][0];
cin >> a[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>
using namespace std;
const int MAXN = 100005;
int n, m, s, f;
int t[MAXN], l[MAXN], r[MAXN];
bool check(long long p, long long l, long long r) {
return (p - l) * (p - r) <= 0;
}
int main(int argc, char const *argv[]) {
scanf("%d%d%d%d", &n, &m, &s, &f);
for (int i = 0; i < m; ++i) scanf("... | 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())
flag = 1
direct = {
1 : "R",
-1 : "L"
}
if s > f :
flag = -1
res = ""
pre_t = 0
for i in range(m) :
t,l,r = map(int,raw_input().split())
if s == f:
break
if t != (pre_t + 1) :
num = 0
if ( t - pre_t - 1) > abs(f-s):
num ... | 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.*;
import java.util.*;
public class B {
public static void main(String[] args) {
FastReader in = new FastReader();
int n = in.nextInt();
int m = in.nextInt();
int s = in.nextInt();
int f = in.nextInt();
int cs = 1;
for(int i = 0; i < m; i++) {
int t = in.nextInt();
int l = in.ne... | 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.*;
import java.math.*;
public class B implements Runnable {
static BufferedReader in;
static PrintWriter out;
static StringTokenizer st;
static Random rnd;
class Segment {
int time, l, r;
public Segment(int time, int l, int r) {
this.time = time;
this.l = l;
this.... | 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 steps {
int l, r, step;
};
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
vector<steps> v(m);
char left = 'L', right = 'R', none = 'X';
for (int i = 0; i < m; i++) cin >> v[i].step >> v[i].l >> v[i].r;
int i, j, st = 1;
if (s < f) {
for (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>
using namespace std;
long long int inf = 1e18;
long long int p = 998244353;
long long int phi(long long int n) {
long long int result = n;
for (long long int i = 2; i * i <= n; i++) {
if (n % i == 0) {
while (n % i == 0) n /= i;
result -= result / i;
}
}
if (n > 1) 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.*;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
public class B
{
String line;
StringTokenizer inputParser;
BufferedReader is;
FileInputStream fstream;
DataInputStream in;
String FInput="";
... | 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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Created with IntelliJ IDEA.
* User: shiwangi
* Date: 9/7/13
* Time: 2:11 PM
* To change this template use File | Settings | File Templates.
*/
public class srm1992 {
public static void main(String[] args) thro... | 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, t;
map<long long, long long> r, l;
int main() {
cin >> n >> m >> s >> f;
while (m--) {
long long x, y;
cin >> t >> x >> y;
l[t] = x, r[t] = y;
}
t = 1;
while (s != f) {
if (s < f) {
if (!r[t] ||
!((s >= l[t] &&... | 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, i, x, l, r, t;
string st;
map<int, vector<int> > mp;
cin >> n >> m >> s >> f;
for (i = 1; i <= m; i++) {
cin >> x >> l >> r;
mp[x].push_back(l);
mp[x].push_back(r);
}
int pos;
if (s < f) {
for (t = 1, pos = s; 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>
using namespace std;
int t[100002], l[100002], r[100002];
int now = 1;
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
for (int i = 0; i < m; i++) cin >> t[i] >> l[i] >> r[i];
int i = 0;
int h = -1;
if (s < f) h = 1;
while (s != f) {
if (t[i] != now || (t[i] == 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 | import java.util.*;
import java.io.*;
public class a {
static long mod = 1000000007;
public static void main(String[] args) throws IOException {
// Scanner input = new Scanner(new File("input.txt"));
// PrintWriter out = new PrintWriter(new File("output.txt"));
input.init(System.in);
... | 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 main():
n, m, s, f = map(int, raw_input().split())
d = dict()
for _ in xrange(m):
t, l, r = map(int, raw_input().split())
d[t] = [l, r]
ans = []
t = 1
mv = 'L' if s > f else 'R'
dx = -1 if s > f else 1
while s != f:
if t in d and (d[t][0] <= s <= d[t][1] or d[... | 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, st, en;
cin >> n >> m >> st >> en;
string ans = "";
int tt = 0;
while (m--) {
int t, l, r;
cin >> t >> l >> r;
if (t != tt + 1) {
while (t != tt + 1) {
tt++;
if (en > st) {
ans += 'R';
st... | 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 mi():
return map(int, input().split())
'''
3 5 1 3
1 1 2
2 2 3
3 3 3
4 1 1
10 1 3
'''
n,m,s,f = mi()
t = [0]*m
l = [0]*m
r = [0]*m
for i in range(m):
t[i],l[i],r[i] = mi()
curp = s
curt = 1
i = 0
a = ''
if f>s:
a = (f-s)*'R'
else:
a = (s-f)*'L'
while i<m and curp!=f:
if t[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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f, t, l, r, dir, curStep = 1, ctr = 0;
char arr[30];
arr[5 + 1] = 'R', arr[5 - 1] = 'L';
cin >> n >> m >> s >> f;
if (f > s)
dir = 1;
else
dir = -1;
while (s != f) {
if (ctr != m)
cin >> t >> l >> r, ++ctr;
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 | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000;
const int MAX_M = 100000;
const int MAX_L = MAX_N + MAX_M;
char v[MAX_L + 4];
int main() {
int n, m, s, f;
scanf("%d%d%d%d", &n, &m, &s, &f);
int d;
char c;
if (s < f)
d = 1, c = 'R';
else
d = -1, c = 'L';
int t = 0;
while (... | 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.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class CF {
public static void main(String[] args) throws Exception {
FastScanner sc = new FastScanner(System.in);
int spies = sc.nextInt();
int checks = sc.nextInt();
int sta... | 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() {
long long n, m, s, f, t, l, r;
cin >> n >> m >> s >> f;
map<long long, long long> L, R;
for (int i = 1; i <= m; ++i) {
cin >> t >> l >> r;
L[t] = l;
R[t] = r;
}
string res = "";
for (int i = 1;; ++i) {
l = L[i];
r = R[i];
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>
using namespace std;
struct node {
int t, l, r;
};
node a[100005];
char ans[300005];
bool cmp(node a, node b) { return a.t < b.t; }
int main() {
int n, m, s, f;
int i, j;
scanf("%d%d%d%d", &n, &m, &s, &f);
for (i = 1; i <= m; i++) {
scanf("%d%d%d", &a[i].t, &a[i].l, &a[i].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 | n,m,s,f=map(int,input().split())
d={}
final=0
for i in range(m):
a=list(map(int,input().split()))
d[a[0]]=[a[1],a[2]]
final=a[0]
z=""
if s<f:
i=0
while s!=f:
i+=1
if i not in d:
s+=1
z+="R"
elif (s not in range(d[i][0],d[i][1]+1)) and (s+1 not in range... | 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;
struct reverse {
bool operator()(const int &left, const int &right) { return (right < left); }
};
struct custom {
bool operator()(const pair<int, int> &left, const pair<int, int> &right) {
return (left.first > right.first);
}
};
void solve() {
int n, m, 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 | #include <bits/stdc++.h>
using namespace std;
const int nm = 100002;
int n, m, s, f;
int t[nm], x[nm], y[nm];
void nhap() {
scanf("%d%d%d%d", &n, &m, &s, &f);
int i;
for (i = 1; i <= m; ++i) scanf("%d%d%d", &t[i], &x[i], &y[i]);
}
bool kt(int i, int j) { return (i >= x[j] && i <= y[j]); }
void xuli() {
int 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>
const int MAX_SIZE = 100100;
int f[MAX_SIZE], l[MAX_SIZE], r[MAX_SIZE];
int n, m;
int from, to;
int main() {
scanf("%d%d%d%d", &n, &m, &from, &to);
for (int i = 1; i <= m; i++) scanf("%d%d%d", f + i, l + i, r + i);
int dir = to - from;
int step = 1;
int x = 0;
f[0] = 0;
l[0] = r[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 | #include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
int main() {
long long int n, m, s, f, j = 0;
cin >> n >> m >> s >> f;
vector<long long int> l, r, t;
for (long long int i = 0; i < m; i++) {
long long int te, le, re;
cin >> te >> le >> re;
t.push_back(te);
l.push_back(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;
const int MAXN = 100010;
int TT, NP;
int L, R, N, M, F, T;
int K[MAXN][3];
int main() {
cin >> N >> M >> F >> T;
memset(K, -1, sizeof(K));
for (int i = 1; i <= M; i++) cin >> K[i][0] >> K[i][1] >> K[i][2];
TT = 0;
NP = F;
int index = 1;
if (F < T)
while (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 | import java.util.Scanner;
public class XeniaAndSpies {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n;
int m,s,f;
n = sc.nextInt();
m = sc.nextInt();
s = sc.nextInt();
f = sc.nextInt();
int[]... | 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 dp[100000 + 25];
struct node {
int iz, der;
long long tiempo;
node() {}
node(long long t, int i, int d) {
tiempo = t;
iz = i;
der = d;
}
};
struct otro {
int proct, pos;
long long tiemp;
otro() {}
otro(int ps, long long time, int timp... | 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.DataInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arra... | 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 | /*package com.fancita.codeforces;*/
import java.io.*;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Queue;
/**
* Created by ashutosh on 26/12/16.
*/
public class b199 extends FastIO {
public static void main(String[] args) {
int n = reader.readInt();
int ... | 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(NULL);
cout.tie(NULL);
long long int n, m, s, f;
cin >> n >> m >> s >> f;
long long int i, j;
long long int t[m], l[m], r[m];
long long int curr = s;
long long int step = 0;
for (i = 0; i < m; 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 static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;
p... | 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 step = 1;
for (int i = 0; i < m; i++) {
int t, l, r;
cin >> t >> l >> r;
if (s == f) return false;
while (step < t) {
if (f > s) {
s++;
cout << "R";
} else if (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 | import sys
spies, turns, note, final = map(int, input().split())
if note < final:
next = 1
else:
next = -1
answer = []
def pass_note(current_turn, next_watch, left, right, note):
# print(f'\n{current_turn}), next watch: {next_watch}, left: {left}, right: {right} has note: {note}, goal: {final}')
if curr... | 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 n, m, s, f;
scanf("%d", &n);
;
scanf("%d", &m);
;
scanf("%d", &s);
;
scanf("%d", &f);
;
vector<pair<int, pair<int, int> > > a(m);
for (int i = 0; i < m; i++) {
scanf("%d", &a[i].first);
;
scanf("%d", &a[i].second.first);
... | 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() {
long long pos;
long long n, m, s, f;
cin >> n >> m >> s >> f;
map<long long, pair<long long, long long> > mp;
for (long long i = 0; i < m; i++) {
int x, y, z;
cin >> x >> y >> z;
mp.insert(make_pair(x, make_pair(y, z)));
}
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 | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
*... | 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 s, f, n, m, l, r, dir, now, i, t, dif, k, h = 0, g;
cin >> n >> m >> s >> f;
now = s;
if (f > s)
dir = 1;
else
dir = -1;
char j;
if (dir == 1)
j = 'R';
else
j = 'L';
i = 1;
while (now != f && h < m) {
scanf("%d %d %d"... | 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.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.lang.Math;
public class Account {
public static void main (String[] args) {
Scanner sc= new Scanner(System.in) ;
int n= sc.nextInt() ;
i... | 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() {
long n, m, s, f, t, l, r, tAnt;
long pos;
char dirout;
int dir;
cin >> n >> m >> s >> f;
pos = s;
if (s > f) {
dir = -1;
dirout = 'L';
} else {
dir = 1;
dirout = 'R';
}
tAnt = 0;
for (int i = 0; i < m; i++) {
cin >> t >... | 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 B {
public static void main(String[] args) {
B solver = new B();
solver.solve();
}
private void solve() {
Scanner sc = new Scanner(System.in);
// sc = new Scanner("3 5 1 3\n" +
// "1 1 2\n" +
// "2 2 3\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>
using namespace std;
void print_steps(int rtime, int steps, bool swap) {
if (swap) {
cout << string(steps, 'L');
cout << string(rtime - steps, 'X');
} else {
cout << string(steps, 'R');
cout << string(rtime - steps, 'X');
}
}
int main() {
int n, m, si, fi, s, f, t, ct = ... | 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 |
if __name__=='__main__':
inp = input()
arr = inp.split(' ')
n = int(arr[0])
m = int(arr[1])
s = int(arr[2])
f = int(arr[3])
ans = ""
ch = 'L'
inc = -1
if s<f:
ch='R'
inc = 1
tm = 1
done = False
for i in range(m):
inp = input()
if done:... | 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 str[10000001];
int k = 0;
int main() {
int n, m, s, f;
scanf("%d%d%d%d", &n, &m, &s, &f);
int ptr = s;
int tmp = 1;
for (int i = 0; i < m; i++) {
int t, l, r;
scanf("%d%d%d", &t, &l, &r);
if (ptr == f) continue;
while (tmp < t) {
if (s < f) {
ptr++;
... | 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() {
int q, w, e, r;
int flag = 0;
int a, b, sum, i, j;
int ans = 0;
int n, m, s, now;
while (~scanf("%d%d%d%d", &n, &m, &s, &e)) {
now = s;
i = 1;
while (m--) {
scanf("%d%d%d", &q, &a, &b);
while (i - 1 != q) {
if (now == e) break;
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 | I=lambda:map(int, raw_input().split())
n, m, s, f = I()
d = {}
for _ in xrange(m):
t, l, r = I()
d[t] = (l, r)
W = 'R' if s < f else 'L'
move = 1 if s < f else -1
i = 1
ans = ''
while True:
if s == f:
break;
if i in d:
if (d[i][0] -1 <= s <= d[i][1] and W == 'R') or (d[i][0] <=... | 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;
char ans[1000009];
int tot;
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
int t[100009], l[100009], r[100009];
for (int i = 1; i <= (m); i++) cin >> t[i] >> l[i] >> r[i];
tot = 0;
int p = 1;
while (1) {
++tot;
if (t[p] == tot) {
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.Scanner;
public class XeniaAndSpies {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int n = in.nextInt(), m = in.nextInt(), s = in.nextInt(), f = in
.nextInt();
char move = (s < f) ? 'R' : 'L';
int start = s, it = 0;
StringBuilder ans = 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>
using namespace std;
int t[100010], l[100010], r[100010];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int i, n, m, s, f, j;
cin >> n >> m >> s >> f;
for ((i) = 0; (i) < (int)(m); (i)++) {
cin >> t[i] >> l[i] >> r[i];
}
i = 0;
for (j = 1;; j++) {
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 | #include <bits/stdc++.h>
using namespace std;
int n, m, s, f, t[110010], l[110010], r[110010], nxt;
char c;
int main() {
cin >> n >> m >> s >> f;
for (int i = 1; i <= m; i++) cin >> t[i] >> l[i] >> r[i];
t[m + 1] = 2 * (int)1e9;
if (f < s)
c = 'L';
else
c = 'R';
int add = f < s ? -1 : 1;
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 | n,m,s,f = map(int,raw_input().split())
flag = 1
if s > f :
flag = -1
res = ""
pre_t = 0
for i in range(m) :
t,l,r = map(int,raw_input().split())
if s == f:
break
if t != (pre_t + 1) :
num = 0
if ( t - pre_t - 1) > abs(f-s):
num = abs(f-s)
else :
... | 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.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class Main{
static StringBuilder c;
static class pair{
int form,to;
public pair(int from,int to) {
this.form=from;this.to=to... | 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(0);
cin.tie(0);
cout.tie(0);
int n, m, s, f;
cin >> n >> m >> s >> f;
map<int, pair<int, int> > mop;
for (int i = 0; i < m; i++) {
int t, l, r;
cin >> t >> l >> r;
mop[t] = {l, r};
}
string ans;
while (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;
map<int, pair<int, int> > w;
int main() {
int n, m, s, f, temp;
cin >> n >> m >> s >> f;
for (int i = 0; i < m; i++) {
cin >> temp;
cin >> w[temp].first >> w[temp].second;
}
int pasos = 1, pos = s;
while (pos != f) {
if (s < f) {
while (w[pasos... | 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;
import java.io.IOException;
import java.util.StringTokenizer;
public class XeniaAndSpies {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
sc.nextInt();
int M = sc.nextInt();
int S = sc.nextInt();
int F = sc.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 java.util.HashMap;
import java.util.Scanner;
public class Problem1 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n, m, s, f;
n = scanner.nextInt();
m = scanner.nextInt();
s = scanner.nextInt();
f = scanner.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 | #include <bits/stdc++.h>
using namespace std;
const int inf = 0x7FFFFFFF;
const int maxn = 1000000;
string ans = "";
int n, m, s, f;
int t, l, r, w = 1;
bool ok = false;
void work() {
if (s == f) {
ok = true;
return;
}
if (s < f)
++s, ans += 'R';
else
--s, ans += 'L';
}
int main() {
cin >> 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 | //package codeforces.train;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class ProblemB {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));
long[] ttl = null;
int txl = 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 | n,m,s,f=map(int,input().split())
p=s
d=-1
c='L'
if s<f:
d=1
c='R'
t=1
ts={}
ans=""
for _ in range(m):
x,y,z=map(int,input().split())
ts[x]=(y,z)
while(p!=f):
if t in ts:
(l,r)=ts[t]
if l<=p<=r or l<=p+d<=r:
ans+='X'
else:
p+=d
ans+=c
el... | 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.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelpe... | 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;
import java.io.StreamTokenizer;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution i... | 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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.... | 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>
#pragma comment(linker, "/stack:225450978")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long Mod = 1000000007LL, INF = 1e9, LINF = 1e18;
const long double Pi = 3.141592653589793116, EPS = 1e-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 sys
N, M, S, F = map(int, raw_input().split())
T = []
for i in xrange(M):
T.append(map(int, raw_input().split()))
T.append((0, 0, 0))
c = 1
p = 0
while S!=F:
NS = S
if S<F:
NS = S+1
else:
NS = S-1
if c==T[p][0] and (T[p][1]<=S<=T[p][2] or T[p][1]<=NS<=T[p][2]):
sys.stdout.write('X')
else:
if S<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 | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A {
public void solve() throws Exception {
int n = nextInt();
int m = nextInt();
int s = nextInt();
int f = 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 javax.print.DocFlavor;
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
import java.io.*;
import java.math.BigInteger;
import java.nio.Buffer;
import java.sql.BatchUpdateException;
import java.util.*;
import java.util.stream.Stream;
import java.util.Vector;
import java.io.IOException;
import java.nio.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;
int32_t main() {
long long n, m, s, f, t, l, r;
cin >> n >> m >> s >> f;
long long t2 = 0;
for (long long i = 1; i <= m; i++) {
if (s == f) return 0;
cin >> t >> l >> r;
if (t2 + 1 < t) {
for (long long i = t2 + 1; i < t; i++) {
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 | import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws IOException {
Solution sol = new Solution();
sol.run();
}
void out(String ans) {
System.out.println(ans);
System.exit(0);
}
void run() throws IOException {
... | 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;
int t, l, r, backT = 0;
cin >> n >> m >> s >> f;
int cur = s;
for (int i = 0; i < m; i++) {
cin >> t >> l >> r;
for (int j = t - backT; j > 0; j--) {
if (cur < f && (j > 1 || (r < cur || cur + 1 < l))) {
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 | #include <bits/stdc++.h>
using namespace std;
int n, m, s, f, t, l, r, t1, px;
char x;
int main() {
cin >> n >> m >> s >> f;
if (f < s)
x = 'L', px = -1;
else
x = 'R', px = 1;
for (int i = 1; i <= m; i++) {
if (s == f) break;
cin >> t >> l >> r;
t1 = t - t1 - 1;
for (int j = 1; j <= t1; ... | 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, l2 = 1;
string sj = "";
int t1 = 0, t2 = 0, l, r;
bool ch = true;
cin >> n >> m >> s >> f;
if (s > f) ch = false;
int e = 0;
for (int i = 0; i < m; i++) {
t1 = t2;
cin >> t2 >> l >> r;
e = t2 - t1 - 1;
while (e &&... | 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.*;
import java.math.*;
import java.lang.*;
public class Main{
public static void main(String []args){
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int m=in.nextInt();
int s=in.nextInt();
int f=in.nextInt();
int[] t=new i... | 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())
ar=[]
for i in range(m):
a,b,c=map(int,raw_input().split())
ar.append([a,b,c])
ans=""
curpos=s
if s<f:
i=0
tm=1
while 1:
if curpos==f:
break
elif i>=m:
ans+="R"
curpos+=1
tm+=1
elif tm!=ar[i][0]:
ans+="R"
curpos+=1
tm+=1
elif (curpos<=ar[i][2] and c... | 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.*;
import java.util.*;
public class XeniaAndSpies {
public static void main(String[] args) throws Exception {
BufferedReader k = new BufferedReader(new InputStreamReader(System.in));
// Scanner k = new Scanner(System.in);
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
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;
static inline bool between(int x, int l, int r) { return x >= l && x <= r; }
int main() {
string actions;
int n, m, s, f;
cin >> n >> m >> s >> f;
map<int, pair<int, int> > stages;
for (int i = 0; i < m; i++) {
int t, l, r;
cin >> t >> l >> r;
stages[t... | 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 maxn = 1e5 + 5;
const int inf = INT_MAX / 2;
int n, m, s, f;
struct node {
int l, r, t;
};
node a[maxn];
bool cmp(node a, node b) { return a.t < b.t; }
int main() {
while (scanf("%d%d%d%d", &n, &m, &s, &f) != EOF) {
for (int i = 0; i < m; i++) {
scan... | 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;
int main() {
int i;
scanf("%d%d%d%d", &n, &m, &s, &f);
int now = 1;
int t, l, r;
int flag = s < f ? 1 : -1;
char step = 'L';
if (flag == 1) step = 'R';
for ((i) = (1); (i) <= (m); ++(i)) {
scanf("%d%d%d", &t, &l, &r);
while (s != f &&... | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.