prompt string | response string |
|---|---|
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int t[100009], l[100009], r[100009];
int main(void) {
int i, n, m, s, f;
while (scanf("%d %d %d %d", &n, &m, &s, &f) == 4) {
for (i = 1; i <= m; i++) {
scanf("%d %d %d", &t[i], &l[i], &r[i]);
}
int start = 1;
for (i = 1; i <= m; i++, start++) {
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | 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.io.StreamTokenizer;
import java.util.Arrays;
public class B {
static int[] u = new int[1010], a = new int[50];
publi... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f;
string ans = "";
cin >> n >> m >> s >> f;
int last = 0;
for (int i = 0; i < m; i++) {
int t, l, r;
cin >> t >> l >> r;
if (s < f) {
for (int j = 0; j < t - last; j++) {
if (s == f) {
cout << ans << e... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.io.*;
import java.util.*;
public class Template implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws FileNotFoundException {
try {
in = new BufferedReader(new FileReader("input.txt"));
o... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.sync_with_stdio(0);
int n, m, s, f;
cin >> n >> m >> s >> f;
char pass = (s > f) ? 'L' : 'R';
int t, l, r;
int prev = 0;
for (int i = 0; i < m; i++) {
cin >> t >> l >> r;
if (s == f) continue;
int frees = t - prev - 1;
for (int... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | maxn=100000+200;
ans=""
def prin():
print ans[1:]
opt=[[] for i in range(maxn)]
N,M,S,T=map(int, raw_input().split())
if S<T:
mv=1
chr='R'
else:
mv=-1
chr='L'
opt[0]=[0,1,N]
for i in range(M):
opt[i+1]=list(map(int, raw_input().split()));
opt[M+1]=[99999999,0,0]
for i in range(M+1):
t,l,r... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
int i = s, t = 1;
string ans = "";
map<int, pair<int, int>> watching;
for (int i = 1; i <= m; i++) {
int t;
cin >> t;
int l, r;
cin >> l >> r;
watching[t] = {l, r};
}
while (i != f) {
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
int t, l, r;
int d = f - s;
cin >> t >> l >> r;
for (int i = 1;; ++i) {
if (i > t) {
cin >> t >> l >> r;
}
if (d > 0) {
if (i != t || s > r || s + 1 < l) {
s++;
cout <<... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | n,m,s,f=list(map(int,input().split()))
if s>f:
a='L'
c=-1
elif s==f:
a='X'
c=0
else:
a='R'
c=1
l=[]
for i in range(m):
l.append(list(map(int,input().split())))
ans=''
if l[0][0]!=1:
d=l[0][0]-1
while s!=f and d>0:
s=s+c
ans=ans+a
d=d-1
for i in range(m):
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | n, m, s, f = [int(x) for x in raw_input().strip().split()]
ans = []
prevt = 1
pos = s
movedir = 'R'
if f < s:
movedir = 'L'
togo = (f - pos if movedir == 'R' else pos - f)
done = False
for i in range(m):
t, l, r = [int(x) for x in raw_input().strip().split()]
if done:
continue
freemoves = t ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.util.*;
import java.io.*;
public class xs
{
public static void main (String[] args) throws Exception{
Scanner in = new Scanner(System.in);
PrintWriter out=new PrintWriter(System.out);
StringBuilder sb=new StringBuilder();
int n=in.nextInt(),m=in.nextInt(),s=in.nextInt()... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import sys
n,m,s,f=map(int,sys.stdin.readline().split())
L=[]
R=[]
T=[]
for i in range(m):
t,l,r=map(int,sys.stdin.readline().split())
T.append(t)
L.append(l)
R.append(r)
if(f>s):
i=s
step=1
ind=0
Ans=""
while(i!=f):
if(ind>=m or T[ind]!=step):
Ans+="R"
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long int n, m, s, f;
cin >> n >> m >> s >> f;
long long int t[m], l[m], r[m];
for (long long i = 0; i < m; i++) {
cin >> t[i] >> l[i] >> r[i];
}
string str;
long long int po... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int n, m, s, f;
map<int, int> l;
map<int, int> r;
int main() {
cin >> n >> m >> s >> f;
for (int i = 0; i < m; i++) {
int x, y, t;
cin >> t >> x >> y;
l[t] = x;
r[t] = y;
}
for (int i = 1; s < f; i++)
if (s + 1 < l[i] |... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int arr[100009][3];
int main() {
int n, m, s, f, i;
vector<char> V;
scanf("%d%d%d%d", &n, &m, &s, &f);
for (i = 1; i <= m; i++) {
scanf("%d%d%d", &arr[i][0], &arr[i][1], &arr[i][2]);
}
int count = 1, ind = 1, curr = s;
if (s < f) {
while (true) {
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.util.*;
import java.io.*;
public class ContestTemplate {
public static void main(String[] args) throws IOException {
rd = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(System.out);
st = new StringTokenizer(rd.readLine());
n = Integer.parseInt(st.nextToken());
m = Int... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class XeniaSpies{
public static void main(String[] argv) throws Exception{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String[] words=br.readLine().trim().split(" ");
int n=Integer.parseInt(words[0]), m=Integer.p... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int n, m, s, f;
int main() {
cin >> n >> m >> s >> f;
int tim = 1;
for (int i = 0; i < m; i++) {
int t, l, r;
scanf("%d%d%d", &t, &l, &r);
while (tim < t && s != f) {
if (s < f)
cout << "R";
else
cout << "L";
if (s < f)
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;
public class Xenia2 {
static StringBuilder result = new StringBuilder();
static int current;
static boolean right;
public static... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import sys
def start():
fin=sys.stdin
n,m,s,f=map(int,fin.readline().split())
res=""
cur=s
if s<f:
i=0
for _ in range(m):
t,l,r=map(int,fin.readline().split())
while i+1<t:
res+="R"
cur+=1
i+=1
if... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
struct W {
int t, l, r;
} w[100010];
int n, m, s, f;
int main() {
while (cin >> n >> m >> s >> f) {
for (int i = (0); i < (m); i++) {
cin >> w[i].t >> w[i].l >> w[i].r;
}
int t = 1, p = 0;
int dir = f > s ? 1 : -1;
while (s != f) {
if (p ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | """http://codeforces.com/problemset/problem/342/B"""
def solve(s, f, t):
res = ''
step = 1 if s < f else -1
i = current = 0
while s != f:
current += 1
ti, l, r = t[i] if i < len(t) else (-1, -1, -1)
if ti == current:
i += 1
if l <= s <= r or l <= s + step... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
struct tn {
int t, l, r;
};
tn lk[111111];
bool in(int loc, int l, int r) {
if (loc >= l && loc <= r) return true;
return false;
}
int absv(int i1) { return i1 < 0 ? -i1 : i1; }
int main() {
int n, m, s, f;
scanf("%d%d%d%d", &n, &m, &s, &f);
int now = s;
int to;
char toc;
if (... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
public class B {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStre... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
const int M = 110000;
int t[M], l[M], r[M];
char ans[2 * M];
int main() {
int i;
int n, m, s, f;
scanf("%d %d %d %d", &n, &m, &s, &f);
for (i = 0; i < m; i++) scanf("%d %d %d", &t[i], &l[i], &r[i]);
int k = 0, cr = 0, ds;
while (s != f) {
if (s < f)
ds... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
map<int, int> m;
void primeFactors(int n) {
while (n % 2 == 0) {
m[2]++;
n = n / 2;
}
for (int i = 3; i <= sqrt(n); i = i + 2) {
while (n % i == 0) {
m[i]++;
n = n / i;
}
}
if (n > 2) m[n]++;
}
long long gcd(long long a, long long b) {
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
struct inter {
int l, r, t;
};
int n, m, s, f;
vector<inter> V;
bool pro(inter a, inter b) { return a.t < b.t; }
int main() {
scanf("%d %d %d %d", &n, &m, &s, &f);
for (int i = 0; i < m; i++) {
inter p;
scanf("%d %d %d", &p.t, &p.l, &p.r);
V.push_back(p);
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
struct T {
int l, r;
int t;
};
T p[100010];
int main() {
long long n, m, s, f;
cin >> n >> m >> s >> f;
s--;
f--;
int last = 0;
for (int i = 0; i < m; i++) {
cin >> p[i].t >> p[i].l >> p[i].r;
p[i].l--;
p[i].r--;
}
if (s < f)
for (int i =... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int spys, steps, start, finish, l, r, t;
int counter;
string res;
map<int, pair<int, int> > step;
bool left;
while (cin >> spys >> steps >> start >> finish) {
res.clear();
step.clear();
counter = 1;
for (int i = 0; i < steps; i++) {
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
int L[100010 * 2], R[100010 * 2];
int main() {
int n, m, x, y;
int t, l, r;
scanf("%d%d%d%d", &n, &m, &x, &y);
for (int i = 0; i < m; i++) {
scanf("%d%d%d", &t, &l, &r);
if (t <= n * 2) {
L[t] = l, R[t] = r;
}
}
for (in... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, u, v, prev = 1, move;
cin >> n >> m >> u >> v;
string output;
for (int i = 0; i < m; i++) {
int t, l, r;
cin >> t >> l >> r;
move = t - prev;
if (u > v) {
move = min(u - v, move);
output += string(move, 'L');
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import sys
a = [int(i) for i in raw_input().split()]
(n, m, s, f) = (a[0], a[1], a[2], a[3])
w = []
for i in range(m):
w.append([int(i) for i in raw_input().split()])
def isWarching(i, st, cw):
if cw >= len(w): return False
if w[cw][0] == st:
return w[cw][1] <= i <= w[cw][2]
cw += 1
if cw >= len(w): return Fa... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long p) {
int res = 1;
x = x % p;
while (y > 0) {
if (y & 1) res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
long long PO(long long a, long long n) {
long long val = 1;
for (long long... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
map<int, int> L, R;
int main() {
int n, m, s, t;
while (scanf("%d%d%d%d", &n, &m, &s, &t) == 4) {
L.clear(), R.clear();
for (int i = 0; i < (m); i++) {
int a, b, x;
scanf("%d%d%d", &x, &a, &b);
L[x] = a, R[x] = b;
}
int dx = (s < t ? 1 ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | n, m, s, f = map(int, input().split())
data = {}
for _ in range(m):
t, l, r = map(int, input().split())
data[t] = (l, r)
k = 1
curr = s
while curr != f:
if k in data:
if data[k][0] <= curr <= data[k][1]:
print('X', end='')
else:
if 1 < curr < n:
if cur... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
class Triplet {
public:
long long x;
long long y;
long long gcd;
};
long long gcd(long long a, long long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
Triplet extendedEuclid(long long a, long long b) {
if (b == 0) {
Triplet ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
int l[100005], r[100005], t[100005];
int main() {
int n, m, s, f, step = 1;
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]);
for (int i = 0; i < m || s != f; i++) {
if (t[i] != step++) {
if (s < f) {
printf("R");
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int s, f, n, m;
int t[100300], x[100300], y[100300];
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]);
string res = "";
int next = 0;
int tiempo = 1;
int cur = 0;
char ch;
while (s != f) {
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int nei(int now, int s, int f) {
if (s < f)
return now + 1;
else
return now - 1;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(NULL);
int n, m, s, f;
cin >> n >> m >> s >> f;
int now = s;
int t_now = 1;
for (int i = 0; i < m; i++) {
int t, l,... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
const long double pi = 3.14159265359;
const long long N = 1e9 + 7;
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n = 0, s, f, e = 1, a, b, c;
cin >> a >> b >> s >> f;
bool g, r = s < f;
while (s != f) {
c = (r ? s + 1 : s - ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | def seen(i, l, r):
return (i >= l and i <= r)
n, m, src, dst = map(int, raw_input().split())
steps = [map(int, raw_input().split()) for i in range(m)]
curr = 1
idx = 0
dx = 1
ans = []
sdx = "R"
if src > dst:
dx = -1
sdx = "L"
while src != dst:
if idx < len(steps) and curr == steps[idx][0]:
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m, s, f;
cin >> n >> m >> s >> f;
int step = 0;
int flag = 0;
while (m) {
if (s == f) return;
int t, l, r;
if (flag == 0) {
cin >> t >> l >> r;
m--;
}
if (s != f) {
step++;
if (step == t) {
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.util.*;
import java.math.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
//FileInputStream cao = new FileInputStream("injava.txt");
Reader.init(System.in);
StringBuilder ans = new StringBuilder();
int n = Reader.nextInt();
int m = Reader.n... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100001;
int n, m, s, f, t[maxn], l[maxn], r[maxn];
int main() {
scanf("%d%d%d%d", &n, &m, &s, &f);
for (int i = 1; i <= m; i++) scanf("%d%d%d", &t[i], &l[i], &r[i]);
if (s < f) {
for (int i = 1, j = 1; i < maxn << 1; i++) {
if (s == f) break... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.util.*;
import java.io.*;
public class Main implements Runnable {
public void solve() throws IOException {
int N = nextInt();
int M = nextInt();
int src = nextInt();
int tgt = nextInt();
int time = 0;
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
inline void boost() {
ios_base::sync_with_stdio();
cin.tie(0);
cout.tie(0);
}
const long long MAXN = 1e5 + 123;
const long long inf = 1e9 + 123;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
map<int, pair<int, int> > mm;
int main() {
boost();
int n, m... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f;
scanf("%d%d%d%d", &n, &m, &s, &f);
int i;
int x[m][3];
for (i = 0; i < m; i++) {
scanf("%d%d%d", &x[i][0], &x[i][1], &x[i][2]);
}
int step = 1;
int add;
int current = s;
if (s < f) {
add = 1;
} else {
add = -1;
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
int n = 3, m = 5, s = 1, f = 3;
cin >> n >> m >> s >> f;
int l, r;
char c = 'L';
int d = -1;
if (s < f) {
c = 'R';
d = 1;
}
int cur = s, step = 0, km = 0;
int next = -1;
if (m > 0) {
cin >> next >> l >> r;
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | R = lambda : map(int , raw_input().split())
n,m,s,f = R()
out = ""
prev_t = 1
sign = 1 if s < f else -1
dir = "R" if sign == 1 else "L"
for i in xrange(m):
t, l, r = R()
while t > prev_t and s != f:
out += dir
s += sign
prev_t += 1
if s == f:
break
if l <= s <= r or l <= s + sign <= r:
out += "X"
else:
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.util.HashMap;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int s = sc.nextInt();
int f = sc.nextInt();
StringBuilder res = new StringBuilder();
HashMap<Integer, Integ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
i... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, m, s, f;
int main() {
ios_base::sync_with_stdio(0);
cin >> n >> m >> s >> f;
vector<pair<int, pair<int, int> > > v(m + 1);
for (long long int i = 0; i < int(m); ++i) {
cin >> v[i].first >> v[i].second.first >> v[i].second.second;
}
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
int l[100009], r[100009], t[100009];
int main() {
int n, m, s, f;
int i, j;
while (scanf("%d%d%d%d", &n, &m, &s, &f) != -1) {
t[0] = 0;
for (i = 1; i <= m; i++) {
scanf("%d%d%d", &t[i], &l[i], &r[i]);
}
int pos = s;
if (s < f) {
int time = 1, d = 1;
f... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | n,m,s,f=map(int,input().split())
t=dict();
for i in range(m):
t1,l1,r1=map(int,input().split())
t[t1]=(l1,r1);
pos=s;i=1;
while(1):
if(pos==f):
break
if i in t:
if t[i][0] <= pos<=t[i][1]:
print('X',end='')
i+=1
continue
elif(f-pos>0 and t[i][0... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | /*
Aman Agarwal
algo.java
*/
import java.util.*;
import java.io.*;
public class B342
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new InputStreamReader(System.in));
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.util.Scanner;
public class XeniaAndSpies {
@SuppressWarnings("unused")
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int spies = sc.nextInt();
int steps = sc.nextInt();
int start = sc.nextInt();
int finish = sc.nextInt();
int mat[][] = new int[3][100001];
in... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
const int INF = 1901486712;
const int MOD = 1000000007;
const double PI = acos(-1);
const double EPS = 1E-9;
bool between(int x, int l, int r) { return (l <= x && x <= r); }
string tostring(int x) {
char dum[20];
sprintf(dum, "%d", x);
string ret(dum);
return ret;
}... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | //B. Xenia and Spies
//time limit per test2 seconds
//memory limit per test256 megabytes
//inputstandard input
//outputstandard output
//Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
//Spy s has an important note. He has ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f, l, r, mi;
int curr, prev = 1;
scanf("%d %d %d %d", &n, &m, &s, &f), curr = s;
for (int i = 1; i <= m && curr != f; i++) {
scanf("%d %d %d", &mi, &l, &r);
for (int j = 0; j < mi - prev && curr != f; j++)
if (s < f)
c... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
struct Node {
int times, l, r;
} node[100005];
int main() {
int n, m, s, f;
int flag = 0;
scanf("%d %d %d %d", &n, &m, &s, &f);
int now = 0;
for (int i = 0; i < m; i++) {
scanf("%d %d %d", &node[i].times, &node[i].l, &node[i].r);
}
if (s <= f) flag = 1;
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
long long mode = pow(10, 9) + 7;
bool cmp(pair<long double, int> x, pair<long double, int> y) {
return x.first < y.first;
}
const long long maxn = 2 * 1e5 + 5;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
long long n, m, s, f;
cin >> n >> m >> s >> f;
map<l... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.util.*;
import java.io.*;
public class BX {
/*
*/
public static BR in;
public static LR lin;
public static PrintWriter out;
public static PrintWriter fout;
static {
try {
in = new BR();
out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(S... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import static java.lang.Math.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m, s, f, t, l, r, i, j = 1;
string st = "";
cin >> n >> m >> s >> f;
for (i = 1; i <= m; i++) {
cin >> t >> l >> r;
if (s == f) {
} else if (s < f) {
while (j <= t) {
if (s == f) {
break;
}
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.io.*;
import java.util.*;
public class Main
{
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.ou... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
const int M = 100005;
int n, m, s, f;
struct interval {
int l, r, ti;
void read() { scanf("%d %d %d", &ti, &l, &r); }
bool judge(int x) {
if (x >= l && x <= r)
return false;
else
return true;
}
} q[M];
void solve() {
int dir = s < f ? 1 : -1;
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
long t[100001];
int l[100001], r[100001];
for (int i = 0; i < m; i++) {
cin >> t[i] >> l[i] >> r[i];
}
t[m] = 1000000001;
int pos = 1;
int tps = s;
int t... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | /**
* Created with IntelliJ IDEA.
* User: den
* Date: 9/7/13
* Time: 11:35 AM
* To change this template use File | Settings | File Templates.
*/
import java.io.*;
import java.util.StringTokenizer;
public class TaskB extends Thread {
private void solve() throws IOException {
int n = _int();
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.util.*;
public class XeniaAndSpies {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
int s = in.nextInt() - 1;
int f = in.nextInt() - 1;
int dir = s < f ? 1 : -1;
StringBuilder sb = new StringBuilder();
int ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.util.*;
import java.io.*;
public class XeniaAndSpies {
public static InputReader in;
public static PrintWriter out;
public static final int MOD = (int) (1e9 + 7);
public static void main(String[] args) {
in = new InputReader(System.in);
out = new PrintWriter(System.out);
int n = in.n... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
int XX[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int YY[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int main() {
ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
long long int n, i, j, t, m, k, l, x, s, f, la... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int msg, dest, m, n, i, li, ri, ti, step = 1;
cin >> n >> m >> msg >> dest;
for (i = 1; i <= m; i++) {
cin >> ti >> li >> ri;
while (step != ti) {
if (msg == dest) goto end;
if (msg < dest)
cout << 'R', msg++;
else
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n, m, st, f, i, j;
long long a, b, c;
set<long long> s;
map<long long, pair<long long, long long> > mp;
cin >> n >> m >> st >> f;
for (i = 0; i < m; i++) {
cin >> a... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... |
import java.io.*;
import java.util.*;
/**
*
* @author Do Quoc bao
*/
public class ProblemB {
public static void main(String[] args) throws java.lang.Exception {
in.init(System.in);
StringBuilder kq=new StringBuilder();
int n=in.nextInt(),m=in.nextInt(),s=in.nextInt(),f=in.nextInt(),i,time=0;
char d=' ';if ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f, _f, i, j, t, L, R, pre;
string ans = "";
cin >> n >> m >> s >> f;
for (pre = i = 0; i < m; i++) {
cin >> t >> L >> R;
if (s == f) continue;
for (j = 1; j < t - pre; j++) {
if (f > s) {
ans += 'R';
++s;
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m, s, f;
cin >> n >> m >> s >> f;
map<int, pair<int, int> > mp;
for (int i = 0; i < m; i++) {
int t, l, r;
cin >> t >> l >> r;
mp[t] = {l, r};
};
string ans;
if (s < f) {
for (int step = 1;; step++) {
if (s == f) {
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
using namespace std;
inline long long in() {
long long x;
scanf("%lld", &x);
return x;
}
int32_t main() {
long long n = in();
long long m = in();
long long s = in();
long long f = in();
lo... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int t[100005], l[100005], r[100005];
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
int c = s;
int last = 0;
for (int i = 0; i < m; i++) cin >> t[i] >> l[i] >> r[i];
string out = "";
int ct = 1;
int k = 0;
while (s != f) {
char ch;
int tt;
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f, t0 = 0;
scanf("%d%d%d%d", &n, &m, &s, &f);
string step;
for (int t, l, r, i = 0; i < m; ++i, t0 = t) {
scanf("%d%d%d", &t, &l, &r);
int dt = t - t0;
if (s < f) {
int d = f - s;
int dx = min(d, dt - 1);
for (... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
map<int, pair<int, int> > mp;
string move = "LRX";
int n, m, s, f, temp, counter = 1;
cin >> n >> m >> s >> f;
for (int i = 0; i < m; i++) {
cin >> temp;
cin >> mp[temp].first;
cin >> mp[temp].second;
}
temp = 1;
if (s > f) {
tem... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int t[100001], L[100001], R[100001];
char dev[300001];
char ff(int dir) {
if (dir == 1) return 'R';
return 'L';
}
bool noesta(int x, int a, int b) {
if (x < a || x > b) return 1;
return 0;
}
int main() {
int n, m, s, f;
while (cin >> n >> m >> s >> f) {
for ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.List;
import java.io.IOException;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.NoSuchEl... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
public static void main(String[] args) throw... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long f = 0, j, q = 1, i, n;
while (q--) {
long long y, k = 1, x, M, s;
cin >> n >> M >> s >> f;
unordered_map<int, pair<int, int> > m;
for (i = 0; i < M; i++) {
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, s, f;
cin >> n >> m >> s >> f;
char move;
int inc;
if (s < f)
move = 'R', inc = 1;
else
move = 'L', inc = -1;
int cur = s, i = 1, cnt = 0;
while (cur != f) {
int t, l, r;
if (cnt < m) {
cin >> t >> l >> r;
c... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
int main() {
int n, m, s, f, t, l, r, cur, inc, i, temp;
char ch;
scanf("%d %d %d %d", &n, &m, &s, &f);
cur = s;
if (s < f) {
inc = 1;
ch = 'R';
} else {
inc = -1;
ch = 'L';
}
temp = 0;
for (i = 0; i < m; i++) {
scanf("%d %d %d", &t, &l, &r);
while (++t... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | n, m, s, f = map(int, input().split())
ans, p = '', 1
if s < f:
for i in range(m):
t, l, r = map(int, input().split())
if t > p:
if t - p < f - s:
ans += 'R' * (t - p)
s += t - p
else:
ans += 'R' * (f - s)
s = f... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | 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 = ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.util.StringTokenizer;
import java.io.*;
public class XeniaAndSpies
{
public static void main(String[]args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tt = new StringTokenizer(br.readLine());
int n = Integer.parseInt(t... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int n, m, s, f, idx_spy, step = 1, idx_xen = 0;
vector<int> tim(100001), lef(100001), righ(100001);
string ans;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m >> s >> f;
for (int i = 0; i < m; i++) cin >> tim[i] >> lef[i] >> righ[i];
tim[m] =... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.util.*;
public class cf342B{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int s = sc.nextInt();
int f = sc.nextInt();
char toApp = 'L';
int toAdd = -1;
StringBuilder ans = new StringBuilder();
if(s < f)
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | import java.util.*;
import java.io.*;
public class XeniaSpies324B
{
public static class MyFasterScanner
{
BufferedReader br;
StringTokenizer st;
public MyFasterScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !s... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int n, m, s, f, l, r, T = 1, t, shift;
char C;
char res[1111111];
int resl;
void read_input() { scanf("%d%d%d%d", &n, &m, &s, &f); }
void write_output() { printf("%s\n", res); }
void solve() {
if (s < f) {
C = 'R';
shift = 1;
} else {
C = 'L';
shift = -1... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int i, j, k, l, x, y, z, m, n, ans, dir, s, f, current, p, q;
pair<int, int> a;
pair<int, pair<int, int> > spies[300000];
int main() {
scanf("%d %d %d %d", &n, &m, &s, &f);
for (i = 0; i < m; i++) {
scanf("%d %d %d", &x, &y, &z);
a = make_pair(y, z);
spies[i... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | def geto(a, b):
return max(0, min(a[1], b[1]) - max(a[0], b[0])+1)
n,m,s,f = map(int, input().split())
di = {}
for _ in range(m):
t, l, r = map(int, input().split())
di[t] = [l, r]
t = 1
ans = []
while s != f:
if f > s:
inte = [s, s+1]
if t in di and geto(inte, di[t]): ans += ['X']
... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
const int N = 1e5 + 10;
using namespace std;
map<int, pair<int, int> > mp;
int main() {
int n, m, s, f;
scanf("%d%d%d%d", &n, &m, &s, &f);
while (m--) {
int t, x, y;
scanf("%d%d%d", &t, &x, &y);
mp[t] = make_pair(x, y);
}
char c;
int mv;
if (s < f)
c = 'R', mv = 1;... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<long long int, long long int> &a,
const pair<long long int, long long int> &b) {
return (a.second < b.second);
}
pair<long long int, long long int> call(long long int n) {
long long int i = 0;
long long int k = n;
while (n % ... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, s, f, t[N], l[N], r[N];
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);
}
t[m] = -1;
int timer = 0, pos = 0;
string ans;
while (s != f) {
char ch;
i... |
Problem: Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int t, l, r, n, m, s, f;
cin >> n >> m >> s >> f;
int cnt = 1;
for (int i = 0; i < m; i++) {
cin >> t >> l >> r;
while (t > cnt && s != f) {
cnt++;
if (s < f)
s++, cout << "R";
else
s--, cout << "L";
}
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.