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 |
|---|---|---|---|---|---|
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int M = 109, N = 2e5 + 9;
int a[M], k;
ll n, f[M][N];
bool v[M][N];
ll dfs(int x, ll s) {
if (x == k) return 0;
if (s < N && v[x][s]) return f[x][s];
ll u = s / a[x], w = u + dfs(x + 1, s) - dfs(x + 1, u);
if (s < N) return v[x][s] = 1, f... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long N, K;
long long res;
long long dp[10000 + 1][101];
int A[101];
long long f(long long n, int k) {
if (n <= 10000)
if (dp[n][k] != -1) return dp[n][k];
long long res = 0;
for (int i = K - 1; i >= k; i--) {
long long n2 = n / A[i];
if (!n2) break;
... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
const long long L = 30000;
long long n;
long long Va = L * L;
int k;
long long dp2[100][L + 1], a[100];
void getS() {
long long temp;
for (int i = 0; i < k; i++) {
dp2[i][0] = 0;
if (i == 0) {
for (int j = 1; j <= L; j++) dp2[i][j] = j / a[0];
continue;
}
for (in... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
template <class T>
int size(const T &a) {
return int(a.size());
}
template <class T>
T sqr(const T &a) {
return a * a;
}
int a[200], n;
long long m;
const int max_n = 150000;
long long dp[101][max_n];
long long calc(int i, long long cur) {
if (cur < max_n && dp[i][cur... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int MAXK = 105;
long long N;
int K, A[MAXK];
template <typename T>
struct growing_vector {
int n;
vector<T> v;
inline void add(const T &x) {
if (n < (int)v.size())
v[n] = x;
else
v.push_back(x);
n++;
}
inline void clear() { n = 0; }
... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | import java.io.*;
import java.util.*;
public class Main {
int[] a;
long n;
long calc(long n,int m){
long res=0;
for(int i=m;i<a.length;i++){
long q=n/a[i];
if(q==0)break;
res+=q;
res-=calc(q,i+1);
}
return res;
... | JAVA |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | import java.io.*;
import java.util.*;
public class E93 {
public static void main(String[] args) throws IOException {
input.init(System.in);
PrintWriter out = new PrintWriter(System.out);
n = input.nextLong();
int k = input.nextInt();
as = new int[k];
for(int i = 0; i<k; i++) as[i] = input.nextInt();
Arrays.sort(... | JAVA |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int c = 128;
const int d = 8192;
long long r[c][d];
long long n;
int k;
int a[c];
long long ans;
long long get(long long n, long long k) {
if (k == 0) return n;
if (n < d && r[k][n] >= 0) return r[k][n];
long long res = get(n, k - 1) - get(n / a[k], k - 1);
if... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n, k;
long long ans = 0;
int v[200];
long long dp[105][212345];
long long solve(int pos, long long mult) {
if (mult > n) return 0;
if (mult < 212345 and dp[pos][mult] != -1) return dp[pos][mult];
if (pos == k) return mult;
long long ret = 0;
ret -= solve... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int maxn = int(105), maxl = int(3e5) + 5;
long long n, a[maxn];
int k;
long long dp[maxn][maxl];
void init() {
memset(dp, -1, sizeof dp);
return;
}
long long solve(int id, long long num) {
if (!id) return num;
if (num < maxl && ~dp[id][num]) return dp[id][num]... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& x) {
bool fu = 0;
char c;
for (c = getchar(); c <= 32; c = getchar())
;
if (c == '-') fu = 1, c = getchar();
for (x = 0; c > 32; c = getchar()) x = x * 10 + c - '0';
if (fu) x = -x;
};
template <class T>
inline void rea... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);
template <class T>
T gcd(T a, T b) {
if (!b) return a;
return gcd(b, a % b);
}
const int maxn = 1e5 + 10;
int n, m, v, cl, ce, ele[maxn], st[maxn];
inline int ABS(int x) { return x < 0 ? ... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.util.*;
public class JavaApplication80 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner Sc=new Scanner(System.in);
int s,e,n,m;
int v;
n=Sc.nextInt();
m=Sc.nextInt();
... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
void fast_io() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
using namespace std;
int main() ... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 47;
int n, m, nl, ne, v, q;
int l[maxn], e[maxn];
int tot, ans;
int main() {
scanf("%d%d%d%d%d", &n, &m, &nl, &ne, &v);
for (int i = 1; i <= nl; i++) scanf("%d", &l[i]);
for (int i = 1; i <= ne; i++) scanf("%d", &e[i]);
sort(l + 1, l + nl +... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
inline long long fexp(long long b, long long e) {
long long x = 1;
for (; e; e >>= 1, b = (b * b) % (1000000007))
if (e & 1) x = (x * b) % (1000000007);
return x;
}
long long n, m, sn, en, v, q, i_0, j_0, i_f, j_f, k;
long long d(long long a, long long b) { return... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long n, m, ns, nl, v, s[100005], l[100005], x1, y11, x2, y2, q;
long long cautbin(long long, long long[], long long, long long);
long long takeElevator(long long, long long, long long, long long, long long);
long long takeStairs(long long, long long, long long, long lo... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long dt[210000], lt[210000], n, m, cl, cd, v;
int binsearch_big(long long a[], int n, int s) {
int mid;
long long l = 1, r = n;
while (l <= r) {
mid = (l + r) / 2;
if (a[mid] >= s)
r = mid - 1;
else
l = mid + 1;
}
if (l >= 1 && l <= n)... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int f(int a, int b) { return abs(a - b); }
int main() {
std::ios_base::sync_with_stdio(false);
;
int n, m, cl, ce, v;
cin >> n >> m >> cl >> ce >> v;
int L[cl + 1], E[ce + 1];
for (int i = 0; i < cl; i++) cin >> L[i];
for (int i = 0; i < ce; i++) cin >> E[i];
... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const int maxn = 100005;
int n, m, cl, ce, v, rocl[maxn], roce[maxn], q;
int xx, x2, yy, y2;
int main() {
scanf("%d%d%d%d%d", &n, &m, &cl, &ce, &v);
for (int i = 1; i <= cl; i++) scanf("%d", &rocl[i]);
for (int i = 1; i <= ce; i++) scanf(... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 |
import bisect as bs
import sys
inp = sys.stdin.readlines()
n, m, ladders, elevators, v = [int(x) for x in inp[0].strip().split()]
ladders = [int(x) for x in inp[1].strip().split()]
elevators = [int(x) for x in inp[2].strip().split()]
q = int(inp[3].strip())
qs = []
for i in range(q):
qs.append([int(x) for x in in... | PYTHON3 |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static int N, M, V, Q;
public static int[] stairs, elevators;
public static void main(String[] args) throws IOException {
BufferedRead... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const int maxn = 100005;
int n, m, cl, ce, v, rocl[maxn], roce[maxn], q;
int xx, x2, yy, y2;
int zheng(int x) { return x > 0 ? x : -x; }
double dzheng(double x) { return x > 0 ? x : -x; }
int deal(int pos, int flag, int now) {
int ans = mod;
... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
void read(long long &x) {
x = 0;
int f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -f;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - 48;
ch = getchar();
}
x *= f;
}
struct Posi {
long l... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b);
long long int gcd(long long int a, long long int b) {
if (a == 0) return b;
return gcd(b % a, a);
}
long long int modulo(long long int a, long long int b) {
long long int r = a % b;
return r < 0 ? r + b : r;
}
uns... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const long long INF = 1000000000000;
int N, M, Q, Cl, Ce;
long long x, y, X, Y, V, ans, l[maxn], e[maxn];
inline int read() {
int ret = 0, f = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-') f = -f;
for (; is... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int INF = 0x3F3F3F3F;
int L[maxn], E[maxn];
int n, m, cl, ce, v, x, q;
int X1, Y1, X2, Y2;
int ans;
int main() {
cin >> n >> m >> cl >> ce >> v;
for (int i = 0; i < cl; i++) {
cin >> x;
L[i] = x;
}
for (int i = 0; i < ce; i++... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int INF = 3 * 1e8 + 10;
int li[100005], ei[100005];
int main() {
int n, m, cl, ce, v, q, x1, y1, x2, y2, tim = INF;
scanf("%d%d%d%d%d", &n, &m, &cl, &ce, &v);
for (int i = 0; i < cl; i++) scanf("%d", &li[i]);
for (int i = 0; i < ce; i++) scanf("%d", &ei[i]);
... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long int i, j, n;
long long int s[100005], el[100005];
int main() {
long long int m, cl, ce, v;
cin >> n >> m >> cl >> ce >> v;
for (i = 0; i < cl; i++) {
cin >> s[i];
}
for (i = 0; i < ce; i++) {
cin >> el[i];
}
long long int q;
cin >> q;
whi... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.*;
import java.util.*;
/**
* Created by hapsi on 11.10.2016.
*/
public class Main {
private static class FastScanner {
private BufferedReader br;
private StringTokenizer st;
public FastScanner(InputStream inputStream){
br = new BufferedReader(new InputStreamRead... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static int N, M, V, Q;
public static int[] stairs, elevators;
public static void main(String[] args) throws IOException {
BufferedRead... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 100004;
const long long Inf = 1e18;
int s[N], e[N];
int main() {
int n, m, cl, ce, v;
scanf("%d %d %d %d %d", &n, &m, &cl, &ce, &v);
int i;
for (i = 1; i <= cl; i++) scanf("%d", &s[i]);
for (i = 1; i <= ce; i++) scanf("%d", &e[i]);
int q;
scanf("... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
public class D {
long MODULO = 1L * 1000 * 1000 * 1000 * 1000 * 1000 ;
long b = 31;
String fileName = "";
class Point{
int x, y;
Point(int x, int y){
this.x = x;
... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const bool debug = false;
const bool INJUDGE = false;
int n, m, c1, c2, v, q;
int e[100005], s[100005];
int fns(int j) {
int f = 0, t = c1 - 1, m;
while (f <= t) {
m = (f + t) >> 1;
if (s[m] > j) {
t = m - 1;
} else {
f = m + 1;
}
}
retur... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C {
static int v;
public static int dist (int i1,int j1,int i2,int j2,int x,int stairs)
{
int ans... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.*;
import java.lang.*;
public class CF967C {
public static void main(String args[]) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] s = br.readLine().split(" ");
int n = Integer.parseInt(s[0]);
int m = Integer.pars... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, m, t, d, v, vt, vd, len, x3, x4, y3, y4, a[100010], b[100010], q;
int main() {
scanf("%d%d%d%d%d", &n, &m, &t, &d, &v);
for (int i = 1; i <= t; i++) scanf("%d", a + i);
for (int i = 1; i <= d; i++) scanf("%d", b + i);
scanf("%d", &q);
while (q--) {
scan... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, m, ns, ne, v, i;
cin >> n >> m >> ns >> ne >> v;
vector<long long int> s(ns), e(ne);
for (i = 0; i < ns; i++) cin >> s[i];
for (i = 0; i < ne; i++) cin >> e[i];
long long int q;
cin >> q;
while (q--) {
long long int x1, y1, ... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1001010;
int a[MAXN], b[MAXN], n, m;
int ca, cb, v, q;
void proc() {
int xx1, xx2, yy1, yy2;
scanf("%d%d%d%d", &xx1, &yy1, &xx2, &yy2);
int p1 = min(yy1, yy2), p2 = max(yy1, yy2);
int d = abs(xx1 - xx2);
int ans = MAXN * 1000;
int tmp1 = lower_b... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.TreeSet;
public class Main {
private static final String NO = "NO";
private static final String YES = "YES";
In... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long int eletime(long long int x1, long long int x2, long long int speed) {
long long int diff = abs(x1 - x2);
long long int ans = diff / speed;
if (diff % speed != 0) {
ans++;
}
return ans;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.*;
import java.util.*;
public class Main implements Runnable {
static ContestScanner in;
static Writer out;
public static void main(String[] args) {
new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
}
public void run() {
Main main = new Main();
try ... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
vector<long long> s, e;
int main() {
long long n, m, s1, e1, v, x, q, x1, x2, y1, y2;
cin >> n >> m >> s1 >> e1 >> v;
long long ss = s1;
long long es = e1;
while (s1--) cin >> x, s.push_back(x);
while (e1--) cin >> x, e.push_back(x);
cin >> q;
while (q--) {
... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | # python3
import sys
from bisect import bisect
def readline(): return tuple(map(int, input().split()))
def readlines():
return (tuple(map(int, line.split())) for line in sys.stdin.readlines())
def bisect_bounds(arr, val):
idx = bisect(arr, val)
if idx: yield idx - 1
if idx < len(arr): yield idx
cl... | PYTHON3 |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, m, v1, v2, v;
int a[100005], b[100005];
int Q, x, y, xx, yy;
int st, el;
int ans;
void init() { freopen("c.in", "r", stdin); }
int get_a(int l, int r, int tot) {
int pos = 1;
while (l <= r) {
int mid = (l + r) / 2;
if (a[mid] < tot) {
pos = mid;
... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const long long int mod = (long long int)(1e9 + 7);
long long int test = 1;
vector<long long int> read(int n) {
vector<long long int> v(n);
for (int i = 0; i < n; i++) cin >> v[i];
return v;
}
void solve() {
long long int i, j, k, n, t, m, cnt = 0, ans = 0, sum = 0;... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.*;
import java.util.*;
public class Codeforces
{
public static void main(String args[])throws Exception
{
BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
String s[]=bu.readLine().split(" ");
int n=Integ... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.util.*;
import java.io.*;
public class StairsElevators {
/************************ SOLUTION STARTS HERE ************************/
static TreeSet<Long> stairs, elevs;
static final long INF = (long) 1e15;
static long checkPossibility(long speed, long x1, long y1, ... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 5;
template <class X>
inline void read(X &x) {
X f = 1;
char ch = getchar();
x = 0;
while (ch > '9' || ch < '0') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch <= '9' && ch >= '0') {
x = x * 10 + ch - 48;
ch = getc... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long inf = 2147483647;
const long long ll = 9223372036854775807, ninf = 1000000000;
const double eps = 1e-6;
const long long nll = 1000000000000000000;
class MinimizeAbsoluteDifferenceDiv1 {
public:
vector<int> findTuple(vector<int> x) {}
};
int main() {
int a, b,... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.*;
import java.util.*;
public class C implements Runnable{
public static void main (String[] args) {new Thread(null, new C(), "_cf", 1 << 28).start();}
public void run() {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
System.err.println("Go!");
int n = fs... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.io.InputStream;
/**
* Built using CHelpe... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const long long mx = 100005;
long long n, m, cl, ce, v;
vector<long long> stair;
vector<long long> elevator;
long long baileft(long long val, vector<long long> &v) {
long long ret = -1;
long long lo = 0;
long long hi = (long long)v.size() - 1;
while (lo <= hi) {
... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
void qmax(int &x, int y) {
if (x < y) x = y;
}
void qmin(int &x, int y) {
if (x > y) x = y;
}
inline int read() {
char s;
int k = 0, base = 1;
while ((s = getchar()) != '-' && s != EOF && !(isdigit(s)))
;
if (s == EOF) exit(0);
if (s == '-') base = -1, s =... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.*;
import java.util.*;
public class StairsAndElevators {
public static TreeSet<Integer> stairs = new TreeSet<>();
public static TreeSet<Integer> elevators= new TreeSet<>();
public static void main (String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputSt... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
const double PI = acos(-1.0);
using namespace std;
template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& v) {
is >> v.first >> v.second;
return is;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& v) {
os << "{";
os << v.f... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.TreeSet;
public class StairsAndElevators {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
St... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int INF = 1e9;
int n, m, cl, ce, v;
int l[maxn], e[maxn];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m >> cl >> ce >> v;
for (int i = 1; i <= cl; i++) {
cin >> l[i];
}
for (int i = 1; i <= ce; i++) {
cin... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int es[2][N], c[2], n, m, v;
int get(int x, int bz, int p) {
int l = 1, r = c[p], mid;
int ret = 0;
while (l <= r) {
mid = (l + r) / 2;
if (bz) {
if (es[p][mid] >= x) {
ret = mid;
r = mid - 1;
} else
... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const int INF = 1e9 + 7;
const long long LINF = 1e18;
const int MOD = INF;
int main() {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
long long n;
cin >> n;
long long m;
cin >> m;
long long l;
cin >> l;
long lo... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int max1 = 1 << 30;
int n, m, cl, ce, v, tt, louti[100002], dianti[100002];
int solve(int x1, int x2, int *num, int cc) {
int t1, t2, res = max1;
t1 = lower_bound(num, num + cc, x1) - num;
if (t1 < cc && num[t1] < x2) return x2 - x1;
t1 = lower_bound(num, num ... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 |
import java.io.*;
import java.math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class C967
{
public static int mod = 1000000007;
public static long INF = (1L << 60);
static FastS... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long n, m;
long long cl, ce;
long long v;
long long l[100000];
long long e[100000];
int main() {
scanf("%lld%lld%lld%lld%lld", &n, &m, &cl, &ce, &v);
for (int i = 0; i < cl; i++) scanf("%lld", l + i);
for (int i = 0; i < ce; i++) scanf... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
signed main() {
long long n, m, cl, ce, v;
scanf("%lld %lld %lld %lld %lld", &n, &m, &cl, &ce, &v);
long long l[cl + 2], e[ce + 2];
for (long long i = 1; i <= cl; i++) scanf("%lld", &l[i]);
for (long long i = 1; i <= ce; i++) scanf("%lld", &e[i]);
l[0] = e[0] = ... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
long long mod = 1e9 + 7;
inline long long pwr(long long base, long long n) {
long long ans = 1;
while (n > 0) {
if (n % 2 == 1) ans = ans * base;
base = base * base;
n /= 2;
}
return ans;
}
struct range {
int l, h;
};
using namespace std;
int main() {
ios_base::sync_with... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int Inf = (int)1e9 + 7;
namespace {
void solve() {
int n, m, cl, ce, v;
cin >> n >> m >> cl >> ce >> v;
vector<int> S(cl), E(ce);
for (int i = 0; i < cl; i++) cin >> S[i];
for (int i = 0; i < ce; i++) cin >> E[i];
int q;
cin >> q;
while (q--) {
int... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int base = 1e9;
const int MAX = 2e5;
const long double EPS = 1e-10;
const long double PI = acos(-1.);
int n, m;
int D, E, v;
int d[MAX];
int e[MAX];
int x1, x2, adlsdss, y2;
int drab() {
int cur = INF;
int pos = lower_... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int dr[] = {0, 1, 0, -1};
const int dc[] = {1, 0, -1, 0};
const int mod = 1e9 + 7;
const int mod2 = 1e9 + 17;
const int mod3 = 1e9 + 19;
long long N, M, S, E, V, s[100001], e[100001], Q;
vector<long long> ss, ee;
int main() {
scanf("%lld %lld %lld %lld %lld", &N, &M... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | from __future__ import division
from sys import stdin, stdout
from collections import *
from bisect import *
rstr = lambda: stdin.readline().strip()
rstrs = lambda: [str(x) for x in stdin.readline().split()]
rstr_2d = lambda n: [rstr() for _ in range(n)]
rint = lambda: int(stdin.readline())
rints = lambda: [int(x) for... | PYTHON |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
int ls[100000];
int es[100000];
int N, M, CL, CE, V;
int res;
void ltest(int x1, int x2, int l, int dy) {
if (l < 0 || l >= CL) return;
res = std::min(res, std::abs(x1 - ls[l]) + std::abs(x2 - ls[l]) + dy);
}
void etest(int x1, int x2, int e, int dy) {
if (e < 0 || e >= CE) return;
res ... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, m, cl, ce, v;
int stair[100005];
int ele[100005];
void solve(int x1, int y1, int x2, int y2) {
int ans = 0x3f3f3f3f;
if (x1 == x2) {
cout << abs(y1 - y2) << endl;
return;
}
int p = lower_bound(stair, stair + cl, y1) - stair;
if (p != cl)
ans = m... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 |
import java.util.*;
import java.io.*;
public class Solution2 {
int INF = 1_000_000_000;
private void solve() throws IOException {
int n = in.nextInt();
int m = in.nextInt();
int colStairs = in.nextInt();
int colLifts = in.nextInt();
int velocity = in.nextInt();
... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int best_t(const vector<int>& v, int pos1, int pos2) {
auto it1 = lower_bound(v.begin(), v.end(), pos1);
auto it2 = lower_bound(v.begin(), v.end(), pos2);
if (v.empty()) return 1e9;
if (it1 != it2) return pos2 - pos1;
if (it1 == v.end()) return pos1 - v.back() + p... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, cl, ce, v;
cin >> n >> m >> cl >> ce >> v;
long long int l[cl], e[ce];
for (int i = 0; i < cl; i++) cin >> l[i];
for (int i = 0; i < ce; i++) cin >> e[i];
int q;
cin >> q;
while (q--) {
long long int x1, y1, x2, y2;
cin >> x1 >... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.BufferedReader;
import java.io.InputStream;
import java.lang.*;
import java.util.*;
public class fan_chipu {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
long n = input.nextLong();
long m = input.nextLong();
long tb = input.nextLong();
long tm = input.next... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
void SolveA() {
int n, s;
cin >> n >> s;
vector<int> v;
v.push_back(-s - 1);
v.push_back(26 * 60);
for (int i = 0; i < n; ++i) {
int h, m;
cin >> h >> m;
v.push_back(60 * h + m);
}
make_heap(v.begin(), v.end());
sort_heap(v.begin(), v.end());
... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int base = 1e9;
const int MAX = 2e5;
const long double EPS = 1e-10;
const long double PI = acos(-1.);
int n, m;
int D, E, v;
int d[MAX];
int e[MAX];
int x1... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, m, v, c1, c2, q, a[120000], b[120000];
int main() {
while (cin >> n >> m >> c1 >> c2 >> v) {
for (int i = 0; i < c1; i++) {
cin >> a[i];
}
for (int i = 0; i < c2; i++) {
cin >> b[i];
}
int q;
cin >> q;
while (q--) {
int... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int l[100010], c[100010];
int main() {
int n, m;
int nl, nc, v;
scanf("%d %d %d %d %d", &n, &m, &nl, &nc, &v);
for (int i = 0; i < nl; i++) {
scanf("%d", &l[i]);
}
for (int i = 0; i < nc; i++) {
scanf("%d", &c[i]);
}
int q;
scanf("%d", &q);
while... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
string tostr(int n) {
stringstream rr;
rr << n;
return rr.str();
}
const int mo... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template <typename... Args>
void writeln(Args... args) {
((cout << args << " "), ...);
cout << endl;
}
template <typename... Args>
void _db(Args... args) {}
ll dist_stairs(ll dx, ll dy) { return dx + dy; }
ll dist_el... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b);
long long int gcd(long long int a, long long int b) {
if (a == 0) return b;
return gcd(b % a, a);
}
long long int modulo(long long int a, long long int b) {
long long int r = a % b;
return r < 0 ? r + b : r;
}
uns... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
using lli = long long;
using ld = long double;
mt19937 rnd(time(nullptr));
const lli inf = 1e18;
lli UpperDiv(lli a, lli b) {
if (a % b == 0) return a / b;
return a / b + 1;
}
lli Res1(set<lli>& first, lli x1, lli y1, lli x2, lli y2) {
lli answer = inf;
auto it = fi... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.*;
import java.util.*;
public class Mainn {
public static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader() {
reader = new BufferedReader(new InputStreamReader(System.in), 32768);
tokenizer = null;
}
public InputReader(InputStrea... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | # Code by Sounak, IIESTS
# ------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threa... | PYTHON3 |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m, st, lt, v, ele, scost, lcost, lows, lowl;
vector<long long> stair, lift;
vector<long long>::iterator it;
cin >> n >> m >> st >> lt >> v;
for (int i = 0; i < st; i++) {
cin >> ele;
stair.push_back(ele);
}
for (int i = 0; i <... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.util.*;
import java.io.*;
import java.math.*;
public class main {
InputStream is;
PrintWriter out;
static long mod=pow(10,9)+7;
int dx[]= {0,0,1,-1},dy[]={+1,-1,0,0};
void solve()
{
int n=ni();
int m=ni();
int cs=ni();
int ce=ni();
int v=ni();
int s[]=na(cs);
int e[]=na(ce);
int q=ni()... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | from sys import maxint
N, M, numStairs, numElevs, speedElev = map(int,raw_input().split())
stairs = map(int,raw_input().split())
elevs = map(int,raw_input().split())
def binarySearch(arr, l, r, x) :
if l >= r-1 : return l
mid = (l+r) / 2
if x < arr[mid] :
return binarySearch(arr,l,mid,x)
elif ... | PYTHON |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
static InputReader in;
static PrintWriter out;
static long TIME_START = 0;
static int cas = 0;
static double eps = 1e-8;
static int mod = (int) 1e9 + 9;
static int inf = 0x3f3... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long elv_dist(long long x1, long long y1, long long x2, long long y2,
long long pos, long long v) {
long long ans =
abs(y1 - pos) + abs(y2 - pos) + ceil(((1.0 * abs(x2 - x1)) / (1.0 * v)));
return ans;
}
long long lf_dist(long long x1, long... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const long long inf = 8000000000000000000;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long y, x, lest, lift, speed;
cin >> y >> x >> lest >> lift >> speed;
vector<long long> lst(lest), lft(lift);
for (long long c = 0; c < lest... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 1000100;
inline long long R() {
char c = '!';
long long x = 0, z = 1;
for (; c > '9' || c < '0'; c = getchar())
if (c == '-') z = -1;
for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - '0';
return x * z;
}
int n, m, c1, c2, Q, cnt, v;
i... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | /*
* UMANG PANCHAL
* DAIICT
*/
import java.util.*;
import java.io.*;
import java.math.*;
import java.util.Comparator;
public class Main
{
private static final Comparator<? super Integer> Comparator = null;
static LinkedList<Integer> adj[];
static ArrayList<Integer> adj1[];
static int[] color,visited1;
stati... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long n, m, s, e, v, q;
vector<long long> vs, ve;
int32_t main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> n >> m >> s >> e >> v;
vs.resize(s), ve.resize(e);
for (auto& u : vs) {
cin >> u;
}
for (auto& u : ve) {
cin >> u;
}
cin >> q;
while ... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int TN = 1;
void solve() {
long long n, m, v;
int cl, ce;
cin >> n >> m >> cl >> ce >> v;
vector<int> li, e;
li.resize(cl);
e.resize(ce);
if (cl > 0)
for (int i = 0; i < cl; i++) cin >> li[i], li[i]--;
if (ce > 0)
for (int i = 0; i < ce; i++) cin >> ... | CPP |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | //package baobab;
import java.io.*;
import java.util.*;
public class C {
public static final boolean DEBUG_PRINTS = false;
public static void main(String[] args) {
Solver solver = new Solver();
}
static class Solver {
IO io;
public Solver() {
this.io = new IO();... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | import java.util.*;
public class JavaApplication80 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner Sc=new Scanner(System.in);
int s,e,n,m;
int v;
n=Sc.nextInt();
m=Sc.nextInt();
... | JAVA |
967_C. Stairs and Elevators | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
long long n, m, cl, ce, v;
vector<long long> s;
vector<long long> e;
cin >> n >> m >> cl >> ce >> v;
for (int i = 0; i < cl; i++) {
long long x;
cin >> x;
s.push_back(x);
}
for (int i = 0; i < ce; i+... | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.