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 java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Scanner;
public class popo {
public static void main(String[] args) {
InputReader in=new InputReader(System.in);
PrintWriter out=new PrintWriter(System.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;
map<int, pair<int, int> > Map;
int n, m, i, s, f, t, l, r;
bool Check(int a) { return ((l <= a) && (a <= r)); }
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m >> s >> f;
for (i = 1; i <= m; i++) {
cin >> t >> l >> r;
Map[t] = make_pair(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.util.*;
public class b199
{
public static void main(String ar[])
{
Scanner obj=new Scanner(System.in);
int n=obj.nextInt();
int m=obj.nextInt();
int s=obj.nextInt();
int f=obj.nextInt();
long a[][]=new long[m][3];
for(int i=0;i<m;i++)
{
a[i][0]=obj.nextLong();
a[i][1]=obj.nextLong();... | 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 double PI = 3.14159265359;
int n, m, s, f;
int main() {
cin >> n >> m >> s >> f;
for (int i = 0, j = 1; i < m; ++i) {
int t, l, r;
scanf("%d %d %d", &t, &l, &r);
for (; j != t; ++j) {
if (f < s)
--s, putchar('L');
else 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 | 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... | 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.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int n, m, s, f;
Scanner in = new Scanner(System.in);
n = in.nextInt();
m = in.nextInt();
s = in.nextInt();
f = 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 | #include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1.0);
vector<string> given;
vector<vector<int>> given1;
int mx1 = -1, mx2 = -1, mx3 = -1;
int bits(int n) {
int ans = 0;
while (n) {
ans += n % 2;
n /= 2;
}
return ans;
}
long long bs(long long a[], long long low, long long high,... | 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 asd[])throws Exception
{
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int m=in.nextInt();
int s=in.nextInt();
int f=in.nextInt();
StringBuilder ss=new StringBuilder();int q=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 | #include <bits/stdc++.h>
using namespace std;
const int Max = 1e5 + 100;
int n, m, s, f, l, r, st = 0, dir;
map<int, pair<int, int> > watch;
string ans = "";
bool isBlocked(int idx, int pos) {
if (watch.find(idx) != watch.end()) {
l = watch[idx].first;
r = watch[idx].second;
if (pos >= l && pos <= r) retu... | 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);
long long cross_prod(long long ax, long long ay, long long bx, long long by,
long long cx, long long cy);
long long sum_digit(long long A);
long long get_mask(long long x);
long long get_nr(string &S, int pos, in... | 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 | /**
* Created with IntelliJ IDEA.
* User: zangetsu
* Date: 9/1/13
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
im... | 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;
bool check(int x, int l, int r) {
if (x >= l && x <= r) return true;
return false;
}
const int maxn = 1e5 + 10;
int n, m, s, f, d, pos;
map<int, int> mp;
pair<int, int> p[maxn];
string ans;
int main() {
cin >> n >> m >> s >> f;
for (int i = 1; i <= m; ++i) {
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, input().split())
c, t1 = 1, 0
ans = ""
t = 1
while s != f and t1 < m:
t, l, r = map(int, input().split())
# print(ans)
while t != c:
if s < f:
ans += "R"
s += 1
else:
ans += "L"
s -= 1
if s == f:
break
c += 1
if s < f:
if s >= l-1 and s <= ... | 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 | '''
||Sri:||
__|
______________|_________________________
| | ___| | | ___| | | |___
/\ /\ | |___ | | |___| | | |___|
/ \/ \ | ___| | | |_/ |___| |___
I am a... | 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;
public class con199_B {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.readLine()... | 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;
typedef struct {
int t, l, r;
} item;
int n, m, s, f;
item a[100005];
int Right() {
int cur = s;
for (int j = 1; j < a[1].t; j++) {
++cur;
cout << "R";
if (cur == f) return 0;
}
for (int i = 1; i <= m; i++) {
if (a[i].l <= cur && cur <= 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 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:300000000")
const long double eps = 1e-20;
const long double pi = acos(-1.0);
const long long inf = 1000 * 1000 * 1000 * 1000 * 1000 * 1000;
const long long base = 1000 * 1000 * 1000 + 7;
using namespace std;
map<int, pair<int, int> > m;
int n, q, s, f, 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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.Scanner;
import java.util.HashMap;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] arg... | 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[1 << 17], L[1 << 17], R[1 << 17];
int main() {
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]);
int cur = 0;
string res = "";
for (int T = 1;; ++T) {
if (s == f) break;
int to = 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())
q = dict()
for i in range(m):
t,l,r = map(int, input().split())
q[t] = (l, r)
k=1;pos=s;
while pos!=f:
if k in q:
if q[k][0] <= pos <= q[k][1]:
print('X', end='')
else:
if 1 < pos < n:
if pos > f:
... | 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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class XeniaAndSpies {
static IR in = new IR(System.in);
static PrintWriter out = new PrintWriter(System.out);
static int N,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 | n, m, s, f = map(int, raw_input().split())
def overlap(r1, r2, s1, s2):
x1, x2 = min(r1, r2), max(r1, r2)
y1, y2 = min(s1, s2), max(s1, s2)
return y2 >= x1 and x2 >= y1
if s > f:
step = (-1, 'L')
else:
step = (1, 'R')
steps = range(0, n + 1)
result = ''
last_timestamp = 1
for i in range(m):
ti... | 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 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.*;
... | 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 i, j, n, m, s, f, l, r, t, c = 0, d;
char g;
cin >> n >> m >> s >> f;
if (s < f) {
d = 1;
g = 'R';
} else if (s > f)
d = -1, g = 'L';
for (i = 1; i <= m; i++) {
if (s == f || s > n || s < 1 || f > n || f < 1) break;
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;
map<int, int> mp;
pair<int, int> a[(int)1e5 + 100];
int n, m, s, g;
int main() {
scanf("%d%d%d%d", &n, &m, &s, &g);
int dx = (s > g) ? -1 : 1;
memset(a, -1, sizeof(a));
for (int i = 1; i <= int(m); i++) {
int l, r, t;
scanf("%d%d%d", &t, &l, &r);
mp[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 | def can(cur, d, l, r):
dst = cur+d
return not ((cur>=l and cur<=r) or (dst>=l and dst<=r))
n, m, s, f = map(int, raw_input().split())
src = [map(int, raw_input().split()) for i in range(m)]
for i in range(len(src)):
src[i][1]-=1
src[i][2]-=1
srcmapa = {}
for i in src:
srcmapa[i[0]] = [i[1], i[2]]
... | 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 | r=lambda:map(int,raw_input().split())
n,m,s,f=r()
T=0
c=['R','L'][f<s]
p=''
o=0
for i in range(m):
#print s,f,p
t,L,R=r()
if T < t-1:
v=min(t-1-T, abs(f-s))
s+=v*(-1)**(f-s<0)
p+=v*c
#print "t:",v,s
if f == s:
break
#print "sp:", L - (f-s>0), R + (f-s<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>
#pragma comment(linker, "/STACK:96777216")
using namespace std;
int main() {
int N, M, s, f;
cin >> N >> M >> s >> f;
int cur = s;
int time = 1;
int T[100000], L[100000], R[100000], p = 0;
for (int i = 0; i < M; i++) cin >> T[i] >> L[i] >> R[i];
while (cur != f) {
if (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 | import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;
import java.util.Arrays;
import java.util.Vector;
public class XAS {
public static void main(String[] args) {
InputStream inpu... | 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 round199;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class B {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni(), m = 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>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
string ans;
map<int, int> ml, mr;
int main() {
int i, j, k, l;
int n, m, s, f;
while (scanf("%d%d%d%d", &n, &m, &s, &f) != EOF) {
ml.clear();
mr.clear();
ans.clear();
for (i = 1; 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f, flag = 0, flagi = 0;
cin >> n >> m >> s >> f;
if (s > f) flag = 1;
for (int i = 1; i <= m; i++) {
int a, b, c;
cin >> a >> b >> c;
for (int j = i; j < a; j++, i++) {
if (s == f) {
break;
flagi = 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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public clas... | 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; }
void move_f(int& s, int l, int r, int n, string& result) {
if (s + 1 <= n && !inside(s + 1, l, r)) {
result += "R";
++s;
} else {
result += "X";
}
}
void move_b(int& s, int 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;
bool find(int l, int m, int r) {
if (m < l) return 1;
if (m > r) return 1;
return 0;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int m, n, s, f, i, ct = 1, t, l, r, cp;
cin >> n >> m >> s >> f;
cp = s;
for (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 | #include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
const int INF = 0x3f3f3f3f;
const int MOD = 100000, STA = 8000010;
const long long LNF = 1LL << 60;
const double EPS = 1e-8;
const double OO = 1e15;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1};
const int day[13] = {0, 31, 28, 31, ... | 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.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) 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;
scanf("%d%d%d%d", &n, &m, &s, &f);
if (s < f) {
int e = s, st = 1;
string ss;
while (m--) {
int t, l, r;
scanf("%d%d%d", &t, &l, &r);
if (st < t)
for (int i = st; i < t; i++)
if (e < 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 main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
int a[m][3];
for (int i = 0; i < m; i++) {
cin >> a[i][0] >> a[i][1] >> a[i][2];
}
int k = 0;
for (int i = 0;; i++) {
if (s == f) {
break;
}
if (f > s) {
if (a[k][0] == 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;
const int maxn = 100005;
int t[maxn], l[maxn], r[maxn];
int main() {
int n, m, from, to, dir;
while (scanf("%d%d%d%d", &n, &m, &from, &to) != EOF) {
for (int i = 0; i < m; i++) {
scanf("%d%d%d", &t[i], &l[i], &r[i]);
}
dir = to > from ? 1 : -1;
cha... | 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 x = 1, y = 0, z = 0, a, b, c, d, e, f, g;
cin >> a >> b >> c >> d;
while (c != d) {
scanf("%d%d%d", &e, &f, &g);
while (x != e) {
if (c == d) {
return 0;
}
if (c < d) {
printf("R");
c++;
} 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;
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
int t = 1, x = s;
int dir = (x < f) ? 1 : -1;
while (m-- > 0) {
int t_in, l, r;
cin >> t_in >> l >> r;
for (; t <= t_in; t++) {
if (t != t_in || !(l <= x && x <= r) && !(l <= x + dir && x + di... | 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;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author KHALED
*/
public class XeniaandSpies {
public static void main(String[] args) {
... | 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;
scanf("%d%d%d%d", &n, &m, &s, &f);
if (s < f) {
int cur = s;
int pret = 0;
while (m--) {
int t, l, r;
scanf("%d%d%d", &t, &l, &r);
if (cur >= f) continue;
while (pret + 1 < t) {
cur++;
pr... | 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 i, j, n, t;
int m;
scanf("%d", &n);
scanf("%d", &m);
int s, e;
scanf("%d", &s);
scanf("%d", &e);
map<int, pair<int, int> > a;
int p, q;
for (int i = (int)1; i < (int)m + 1; ++i) {
scanf("%d", &t);
scanf("%d", &p);
scanf("%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 | #include <bits/stdc++.h>
using namespace std;
int T[100000];
int L[100000];
int R[100000];
bool notLie(int a, int l, int r) { return (!(a >= l && a <= r)); }
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]);
int curTime = 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() {
ios::sync_with_stdio(false);
string ans = "";
long long time, n, m, s, f;
cin >> n >> m >> s >> f;
vector<int> t(m), l(m), r(m);
for (long long i = 0; i < m; i++) {
cin >> t[i] >> l[i] >> r[i];
}
if (s < f) {
time = 1;
vector<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>
using namespace std;
const long long INF = 1ll << 32;
int n, m, s, e;
string ans = "";
bool ch(int l, int r, int idx, bool b) {
bool re = 1;
if (l <= idx && idx <= r) re = 0;
if (b) {
if (l <= idx + 1 && idx + 1 <= r) re = 0;
} else if (l <= idx - 1 && idx - 1 <= r)
re = 0;
re... | 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, e, top;
bool dis;
struct query {
int t, l, r;
} q[100005];
int main() {
int i, j;
scanf("%d%d%d%d", &n, &m, &s, &e);
for (i = 0; i < m; i++) {
scanf("%d%d%d", &q[i].t, &q[i].l, &q[i].r);
}
for (i = 1;; i++) {
if (q[top].t == i && q[top].l <= s && q[top].r >= 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 sys
input = sys.stdin.readline
def print(val):
sys.stdout.write(str(val) + '\n')
def prog():
n,m,s,f = map(int,input().split())
curr = s
step = 1
steps = {}
output = []
for i in range(m):
t,l,r = map(int,input().split())
steps[t] = [l,r]
if f > s:
while cur... | 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 | while True:
try:
def soln(n, m, s, t, stp):
stp.sort()
flg = True
if s > t:
flg = False
i = 1
j = 0
ans = []
while True:
fund = False
while j < m:
if stp[j][0] == i:
j += 1
fund = True
break
if fund and not flg:
a= max(stp[j-1][1], stp[j-1][2])
b =... | 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.*;
import java.io.*;
import java.lang.*;
public class Codeforces{
public static void main(String[] args) {
FastScanner sc =new FastScanner();
PrintWriter out=new PrintWriter(System.out);
int n=sc.nextInt(),m=sc.nextInt(),start=sc.nextInt(),end=sc.nextInt();
Map<Inte... | 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.math.BigInteger;
import java.nio.charset.Charset;
public class olymp {
FastScanner in;
PrintWriter out;
public void solve() throws IOException {
int n = in.nextInt();
int m = in.nextInt();
int s = in.nextInt();
int f = in.nextInt();
ArrayList<Integer[]> w... | 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 = 0x3f3f3f3f;
const int maxN = 1e5 + 10;
int n, m, s, f;
int t[maxN], l[maxN], r[maxN];
bool inside(int l, int m, int r) { return l <= m && m <= r; }
void slv() {
int d = f > s ? 1 : -1;
m++;
t[m] = inf, l[m] = inf, r[m] = -inf;
int tm = 1;
int p = 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() {
int n, m, s, f, i;
cin >> n >> m >> s >> f;
long long t;
map<long long, pair<int, int>> h;
pair<int, int> R;
for (i = 0; i < m; i++) {
cin >> t >> R.first >> R.second;
h[t] = R;
}
i = 1;
if (s < f)
while (s != f) {
if (h.find... | 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 | import java.io.*;
import java.util.*;
public class Solution{
public static void main(String []args){
//System.out.println("Hello World");
Solution ob=new Solution();
ob.go();
}
void go() {
Scanner sc=new Scanner(System.in);
int step=1,t,l,r;
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 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
/**
* Created with IntelliJ IDEA.
* User: Evgeniy
* Date: 9/11/13
* Time: 4:22 PM
*/
public class Main {
StringTokenizer tokeni... | 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;
vector<long long> t;
vector<long long> left;
vector<long long> right;
cin >> n >> m >> s >> f;
for (int i = 0; i < m; i++) {
long long ti, li, ri;
cin >> ti >> li >> ri;
t.push_back(ti);
left.push_back(li);
... | 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.*;
import java.*;
import java.math.BigInteger;
public class zad {
private static BufferedReader in;
private static StringTokenizer tok;
private static PrintWriter out;
private static String readToken() throws IOException {
while (tok == null || !tok.hasMoreTo... | 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);
int n, m, s, f;
cin >> n >> m >> s >> f;
s--;
f--;
map<int, pair<int, int> > x;
for (int i = 0; i < m; i++) {
int t, l, r;
cin >> t >> l >> r;
x[t] = {l - 1, r - 1};
}
string ans = "";
for (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 | n, m, s, f = map(int, raw_input().split());
now = 1;
ret = '';
for i in range(m):
t, l, r = map(int, raw_input().split());
if (s < f):
while (s < f and now < t):
s += 1;
now += 1;
ret += 'R';
if (s == f): continue;
else:
if (s >= l - 1 and s <= r):
ret += 'X';
else:
ret += 'R';
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;
struct adel {
int pos;
int end;
int dir;
int cc;
char car;
void assign(int a, int b) {
if (a < b)
pos = a, end = b, dir = 1, car = 'R';
else
pos = a, end = b, dir = -1, car = 'L';
cc = abs(a - b);
}
bool qua(int a, int b) {
if (!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;
using ll = long long;
using vi = vector<int>;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m, s, f;
cin >> n >> m >> s >> f;
int ct = 1;
while (m--) {
int t, l, r;
cin >> t >> l >> r;
while (ct < t && s != f) {
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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main{
public static void main(String args[])
{
MyScanner scanner = new MyScanner();
int n = scanner.nextInt(), m = scanner.nextInt(), s = 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 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
static int tPos;
public static int mover(int s, int f, int mat[][], int t){
if((mat[tPos][1]<=s)&&(mat[tPos][2]>=s)&&(mat[tPos][0]==t)){
tPos++;
return 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.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.math.*;
import java.net.*;
public class Task{
public static void main(String[] args) throws IOException{
new Task().run();
}
StreamTokenizer in;
Scanner ins;
PrintWriter out;
int nextInt() throws... | 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 spies
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintWriter pr=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
//System.o... | 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.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class B {
static StringTokenizer 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 | import java.util.*;
import java.io.*;
import java.math.*;
public class B {
void solve() {
int n = sc.nextInt();
int m = sc.nextInt();
int s = sc.nextInt();
int f = sc.nextInt();
int T[] = new int[m];
int L[] = new int[m];
int R[] = new int[m];
for (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 | import java.util.*;
import java.io.*;
/*
* author:yanghui
*/
public class B {
class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
tokenizer = null;
}
public InputRe... | 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 l[100005], r[100005], t[100005];
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);
}
int ind = 0, pos = s, j, dir, c;
if (f > s) {
dir = 1;
c = 1;
} else {
di... | 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 io() {
cin.tie(0);
ios_base::sync_with_stdio(false);
}
bool deg = false;
const int N = 1200011;
char a[N];
int main() {
int i, j, s, f, n, m, l, r, t, i2 = 0, st = 0;
scanf("%d", &n), scanf("%d", &m), scanf("%d", &s), scanf("%d", &f);
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 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int t[maxn], l[maxn], r[maxn];
bool judge(int x, int y, int z) {
if (z < x) return true;
if (z > y) return true;
return false;
}
bool judge2(int x, int y, int z) {
if (judge(x, y, z) && judge(x, y, z + 1)) return true;
return false;
}
bool... | 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, int> l, r;
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m >> s >> f;
for (int i = 1; i <= m; i++) {
int t, x, y;
cin >> t >> x >> y;
l[t] = x;
r[t] = y;
}
int i = 1;
while (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;
int main() {
int nspy;
int nstep;
int s, f;
cin >> nspy >> nstep >> s >> f;
int step[nstep + 2][4];
step[nstep + 2][1] = 0;
for (int i = 1; i <= nstep; i++) {
cin >> step[i][1] >> step[i][2] >> step[i][3];
}
char c;
int mode;
if (s < f) mode = 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() {
int n, m, s, f;
cin >> n >> m >> s >> f;
int *t = new int[m], *l = new int[m], *r = new int[m];
for (int i = 0; i < m; i++) cin >> t[i] >> l[i] >> r[i];
char move = 'R';
if (s > f) move = 'L';
string ans = "";
int time = 1, pos = s;
for (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>
using namespace std;
void io_in_data() {
freopen("data.in", "r", stdin);
freopen("data1.out", "w", stdout);
}
const int MAXN = 100007;
struct Node {
int t, l, r;
int judge(int x) { return x >= l && x <= r; }
} w[MAXN];
int main() {
int n, m, s, f;
while (~scanf("%d%d%d%d", &n, &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>
using namespace std;
template <typename T>
string tostr(T a) {
stringstream ss;
ss << a;
return ss.str();
}
int main() {
int n, m, f, s;
cin >> n >> m >> f >> s;
f--;
s--;
int x = f;
int t = 0;
for (int i = 1; i <= m; i++) {
if (x == s) break;
t++;
int l, r, ti;
... | 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 | /*
~/BAU/ACM-ICPC/Teams/Rampage/MMZA
~/sudo apt-get verdict Accepted
practice...
*/
//package javaapplication1;
//import java.util.Scanner;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import 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>
struct node {
int id, l, r;
} a[100005];
int main() {
int n, m, s, f;
while (scanf("%d %d %d %d", &n, &m, &s, &f) != EOF) {
memset(a, 0, sizeof a);
for (int i = 0; i < m; i++) scanf("%d %d %d", &a[i].id, &a[i].l, &a[i].r);
int t = 1, note = s;
for (int 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f, l[100005], r[100005], t[100005], i, j = 1;
cin >> n >> m >> s >> f;
t[m + 1] = 1000000000;
for (i = 1; i <= m; i++) cin >> t[i] >> l[i] >> r[i];
i = 1;
while (1) {
if (i <= m + 1 && j > t[i]) i++;
if (s == f) break;
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.*;
import java.awt.Point;
import java.math.BigDecimal;
import java.math.BigInteger;
import static java.lang.Math.*;
// Solution is at the bottom of code
public class B implements Runnable{
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader... | 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
def inrange(x, l, r):
return x >= l and x <= r
n,m,s,f = [int(x) for x in sys.stdin.readline().strip().split()]
s = s-1
f = f-1
moves = []
for x in xrange(m):
if s == f:
break
t,l,r = [int(z) for z in sys.stdin.readline().strip().split()]
t = t-1
l = l-1
r = r-1
while len(moves) < t:
... | 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.*;
import static java.lang.Math.*;
public class Solution {
private IO io;
private int ioMode = -1;
private String problemName = "";
private final String mjArgument = "master_j";
public static void main(String programArguments[]) throws IOException{
if(pro... | 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.IOException;
import java.io.InputStream;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
public class Main {
static int maxn = (int)(1e5 + 5);
static int[] t = new int[maxn];
... | 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, T, C;
char chr[2] = {'R', 'L'};
int main(void) {
int Ti, Li, Ri, i, j, tp;
scanf("%d%d%d%d", &N, &M, &S, &F);
tp = S > F;
C = S;
T = 1;
for (i = 0; i < M; ++i) {
scanf("%d%d%d", &Ti, &Li, &Ri);
if (Ti > T) {
int st = (Ti - T > (F - C < 0 ? -(F - C) : 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.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 | import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReade... | 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;
using ll = long long;
using lli = long long int;
using ld = long double;
const int N = 2e5 + 5, inf = 1e18;
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>> mp;
int cnt = 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() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m, s, f;
cin >> n >> m >> s >> f;
long long t, l, r, h = 0;
for (int i = 0; i < m; i++) {
cin >> t >> l >> r;
if (s == f) break;
if (t - h != 1) {
long long x = t - h - 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>
const double pi = acos(-1.0);
using namespace std;
int al[100005], ar[100005], at[100005];
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
for (int i = 0; i < m; ++i) {
scanf("%d %d %d", &at[i + 1], &al[i + 1], &ar[i + 1]);
}
at[m + 1] = 2e9;
int cur = s;
int et = 1, 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;
template <class T>
T abs(T x) {
return x > 0 ? x : -x;
}
int n;
int m;
int s, f;
int t[100000];
int x[100000];
int y[100000];
int main() {
scanf("%d%d%d%d", &n, &m, &s, &f);
for (int i = 0; i < m; i++) {
scanf("%d%d%d", &t[i], &x[i], &y[i]);
t[i]--;
}
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;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, m, f, s;
cin >> n >> m >> s >> f;
char x = (s < f ? 'R' : 'L');
bool ok = 0;
string ans;
int hold = 0;
while (m--) {
int t, l, r;
cin >> t >> l >> r;
if (ok)... | 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 t[100001], l[100001], r[100001];
int main() {
int n, m, s, f, i, j;
while (scanf("%d%d%d%d", &n, &m, &s, &f) != EOF) {
for (i = 1; i <= m; i++) {
scanf("%d%d%d", &t[i], &l[i], &r[i]);
}
if (s < f) {
for (i = 1, j = 1; i <= m; i++) {
if (t[j] == 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;
int main() {
int n, m, s, f;
int arr[100000][3];
cin >> n >> m >> s >> f;
for (int i = 0; i < m; i++)
for (int j = 0; j < 3; j++) cin >> arr[i][j];
int i = 0, c = 0, l, r;
while (s != f) {
if (i + 1 == arr[c][0]) {
l = arr[c][1];
r = arr[c][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 main() {
int n, m, s, f, t = 1;
char k;
cin >> n >> m >> s >> f;
int mv = (f > s ? 1 : -1);
k = (f > s ? 'R' : 'L');
for (int x = 1; x <= m; x++) {
int a, b, c;
cin >> a >> b >> c;
if (s == f) break;
while (t < a && s != f) {
cout << k;... | 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>
typedef struct steps {
int t;
int l;
int r;
};
using namespace std;
int main() {
int n, m, s, f;
vector<steps> a;
cin >> n >> m >> s >> f;
for (int i = 0; i < m; i++) {
steps step;
cin >> step.t >> step.l >> step.r;
a.push_back(step);
}
int idx = s;
int step = 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.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;
public class Main{
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream... | JAVA |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.