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
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; using cord = long double; const long double PI = acos(-1); const long double EPS = 1e-8; int signal(cord x) { return (x > EPS) - (x < -EPS); } struct point { cord x, y; point(cord _x, cord _y) : x(_x), y(_y) {} point() : x(0), y(0) {} void operator=(const point& p) ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int ANS; const int C = 40400; const int N = 62; int n, m; int a[N], b[N]; vector<int> da, db; int c[C]; bool ua[N], ub[N]; void solve(int S) { int st = 0; for (int i = 0; i < n; i++) { ua[i] = 0; for (int y : db) ua[i] |= a[i] + y == S; st += ua[i]; if (...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int maxN = 63; struct killer { int pos; int v1, v2; bool operator<(const killer& who) const { return pos < who.pos; } }; struct group { vector<int> v1, v2; }; int n, m, i, j; int A[maxN], B[maxN]; vector<killer> data; vector<group> grps; group aux; int prop1[m...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class C { static int MAX = 40001; static int delta = 20000; public static void main(String[] args) throws IOException { MyScanner sc = new MyScanner...
JAVA
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; map<long long, long long> fl, fr; long long corx, cx, n, m, a[65], x[65]; long long nowL, nowR, i, j; int res; vector<pair<long long, long long> > all; int _bp(long long a) { int ans = 0; while (a) { ans += a & 1; a >>= 1; } return ans; } int main() { cin ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int* lar = new int[n]; int* rar = new int[m]; bool* lma = new bool[n]; bool* rma = new bool[m]; for (int i = 0; i < n; i++) { cin >> lar[i]; lar[i] *= 2; lma[i] = 0; } for (int i = 0; i < m; i++) { cin ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int n, m, ans = 0; int a[100005], b[100005]; int ta[2 * 100005], tb[2 * 100005]; bitset<105> A[105][105], B[105][105], tmpa, tmpb; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); a[i] += 10000; ta[a[i]] = 1; } for (...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; template <typename T> using min_queue = priority_queue<T, vector<T>, greater<T>>; const long long MOD = 1e9 + 7; int N, M; int x[66], y[66]; long long a[4000], b[4000]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> N >> M; for (int i = 0; i < N; i++) cin ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const long long N = 65; long long a[N], b[N]; bitset<N> x[N * N], y[N * N]; double pos[N * N]; signed main() { long long n, m, ans = 0; scanf("%lld%lld", &n, &m); for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]); for (long long i = 1; i <= m; i++) scanf("%lld...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
import sun.rmi.transport.DGCImpl_Stub; import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws FileNotFoundException { ConsoleIO io = new ConsoleIO(new InputStreamReader(System.in), new PrintWriter(System.out)); // String fileName = "C-large"; // ...
JAVA
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int n, m, ans; int a[62], b[62]; map<int, bitset<122> > mp; int nrbit(bitset<122> x) { int nr = 0; for (int i = 0; i < 122; i++) if (x[i] == 1) nr++; return nr; } int main() { cin >> n >> m; for (int i = 1; i <= n; i++) cin >> a[i]; for (int j = 1; j <= m; j...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> const int N = 63; long long dp[N * N][2]; int cnt, n, m, x[N], y[N]; std::map<int, int> f; int solve(long long x) { int res = 0; while (x) res += x & 1, x >>= 1; return res; } int main() { scanf("%d%d", &n, &m); for (int i = 0; i < n; i++) scanf("%d", x + i); for (int i = 0; i < m; ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const int FFTMOD = 1007681537; const int INF = (int)1e9; const long long LINF = (long long)1e18; const long double PI = acos((long double)-1); const long double EPS = 1e-9; inline long long gcd(long long a, long long b) { long long r; while...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int Mx = 20000; int p[100], q[100]; bitset<150> Bitset[40010], tmp; int fv[40010]; int main() { ios_base ::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) cin >> p[i]; for (int i = 1; i <= m; i++) cin >>...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; struct Destroyer { long long x; long long y; bool operator==(Destroyer const a) const { return x == a.x && y == a.y; } }; int const nmax = 60; int v[5 + nmax]; int v2[5 + nmax]; map<double, Destroyer> power; vector<double> poss; int main() { int n, m; cin >> n >> ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const long long dx[] = {0, 1, 0, -1}; const long long dy[] = {1, 0, -1, 0}; const long long inf = 2e9; const long long mod = 998244353; const long long N = 1e2 + 11; const long long NMAX = 1e4 + 11; const long long INF64 = 3e18 + 1; const double eps = 1e-14; const double PI...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int l[100], r[100], n, m; map<int, int> id; vector<int> sum; map<int, long long> sl, sr; int getans(long long a, long long b) { int res = 0, cnt = 0; while (a) { res += (a & 1); cnt++; a >>= 1; } cnt = 0; while (b) { res += (b & 1); cnt++; ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; long long maskA[40005], maskB[40005]; set<int> pts; vector<int> v; int n, m; int yA[65], yB[65]; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) cin >> yA[i]; for (int i = 1; i <= m; i++) cin >> yB[i]; for (int i = 1; i <= n; i++) { for (int j = 1; j <=...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> inline int pidorand() { return ((rand() & 32767) << 15) | (rand() & 32767); } using namespace std; inline int nxt() { int x; scanf("%d", &x); return x; } const int N = 121; using Bs = bitset<N>; int main() { int n = nxt(), m = nxt(); vector<int> a(n), b(m); for (int& x : a) { x ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> std::unordered_map<int, int> ycnt[2]{}; int n[2], ret = 0, Y; int main() { scanf(" %d%d", &n[0], &n[1]); for (int i = 0; i < 2; ++i) for (int j = 0; j < n[i]; ++j) { scanf("%d", &Y); ++ycnt[i][Y << 1]; } for (auto itr : ycnt[0]) for (auto jtr : ycnt[1]) { int...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:256000000") using namespace std; const int INF = (int)(1e9 + 1e5); const long long LINF = (long long)(1e18); const long long MX = 100500; const double EPS = 1e-9; const int MOD = 1000000007; const int MAXN = 3606; const int LOG = 20; struct win { long long mask...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; void fast() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } void ran() { srand(chrono::steady_clock::now().time_since_epoch().count()); } long long get_rand() { long long a = rand(); long long b = rand(); return a * (RAND_MAX + 1ll) + b; } void us...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int MAXN = 63; const int MAXY = 10000; int cntbam[MAXY + MAXY + 13]; int cntdan[MAXY + MAXY + 13]; vector<int> bam, dan; int conjbam[MAXY * 4 + 13][MAXN]; int conjdan[MAXY * 4 + 13][MAXN]; int weight[MAXY * 4 + 13]; int main() { memset(conjbam, -1, sizeof conjbam); ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int MN = 40005, inf = 1000000005, MOD = 1000000007; const long long INF = 1000000000000000005LL; int pos[200]; bitset<125> ziomki[MN], cur; vector<int> dobre; int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++i) scanf("%d", &pos[i]); for ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; bitset<64> f1[3610], f2[3610]; int n, m; map<int, vector<int>> mp1, mp2; int y[66], y2[66]; set<int> s; vector<int> res; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) cin >> y[i], y[i] *= 2, mp1[y[i]].push_back(i); for (int i = 1; i <= m; i++) cin >> y2...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = 0; c = getchar(); } while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + (c ^ 48), c = getchar(); return f ? x : -x; } long long n,...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int max_n = 1e5 + 5; bitset<61> dupa[50000][2]; int main() { int(n), (m); scanf("%d%d", &(n), &(m)); ; vector<int>(v); for (int i = (0); i < ((n)); ++i) { int(a); scanf("%d", &(a)); ; (v).push_back(a); }; vector<int>(w); for (int i = (0...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; int n0, n1, dat0[65], dat1[65]; long long fil0[40005], fil1[40005]; int main() { scanf("%d%d", &n0, &n1); for (int i = 0; i < (int)(n0); i++) scanf("%d", &dat0[i]); for (int i = 0; i < (int)(n1); i++) scanf("%d", &dat1[i]); for (int i = 0; i...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; bitset<65> tt1[50000], tt2[50000]; int a[105], b[105]; vector<int> test; map<int, bool> has; int main() { bitset<65> *t1 = tt1 + 25000, *t2 = tt2 + 25000; int n, m; scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); } for (int j = 1; j...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 65, Y = 1e4 + 5; int n, m, a[N], b[N], cnt1[2 * Y], cnt2[2 * Y]; bool inbounds(int x) { return 0 <= x && x <= 20000; } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for (int i = (0); i < (n); i++) { cin >> a[i]; cnt1[a[i]...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; bitset<125> mark[4000]; bitset<125> res; int id[4000]; int yy1[100], yy2[100]; int vis[50000]; int main() { int cnt = 0; int n, m; scanf("%d%d", &n, &m); for (int i = 0; i < n; i++) scanf("%d", &yy1[i]); for (int i = 0; i < m; i++) scanf("%d", &yy2[i]); memset(v...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; map<int, int> s1; for (int i = 0; i < n; i++) { int x; cin >> x; s1[x]++; } vector<pair<int, int>> A(s1.begin(), s1.end()); map<int, int> s2; for (int i = ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const double PI = acos(-1); const long long INFF = 1e18; const int INF = 1e9; const int mod = 1e9 + 7; const int MAX = 1e5 + 7; int a[61], b[61]; vector<int> na[MAX], nb[MAX]; bitset<61> ca, cb; vector<int> pt; long long cnt1[MAX], cnt2[MAX]; int ma...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; vector<int> space0(n), space1(m); for (int i = 0; i < n; i++) cin >> space0[i]; for (int i = 0; i < m; i++) cin >> space1[i]; set<int> pos; map<int, pair<long long, long...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
import java.io.*; import java.util.*; public class CFC { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; private static final long MOD = 1000L * 1000L * 1000L + 9; private static final int[] dx = {0, -1, 0, 1}; private static final int[] dy = {1, 0, -1, 0}; privat...
JAVA
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; typedef bitset<2 * 60> bset; int A[60], B[60], nA, nB; bset mask[60 * 60]; map<int, vector<int> > at; int main() { scanf("%d%d", &nA, &nB); for (int i = 0; i < nA; ++i) { scanf("%d", A + i); A[i] *= 2; } for (int i = 0; i < nB; ++i) { scanf("%d", B + i);...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 67; int n, m, a[N], b[N]; vector<long long> v1, v2; long long s1[40007], s2[40007]; int ans; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int i, j; scanf("%d %d", &n, &m); for (i = 1; i <= n; i++) { scanf("%d", &a[i]); a[i] +...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n), b(m); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < m; i++) { cin >> b[i]; } unordered_map<int, int> idx; vector<vector<int>> destroy; for (int i = 0; i < n; i++) { fo...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; inline char gc() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++; } inline int read() { int x = 0; char ch = getchar(); bool positive = 1; for ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; vector<int> space0(n), space1(m); for (int i = 0; i < n; i++) cin >> space0[i]; for (int i = 0; i < m; i++) cin >> space1[i]; set<int> pos; vector<int> p; map<int, pai...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long N = 3600 + 5; const long double pi = 3.14159265359; void SRAND() { auto duration = std::chrono::system_clock::now().time_since_epoch(); auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(duration).cou...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 65; pair<int, int> ar[N], ar1[N]; int ar2[N], ar3[N]; int lis[70005]; bool check[N], check1[N]; int main() { int n, m, i, j, k, l, z, sum = 0, ans = 0, max1 = 0; cin >> n >> m; for (i = 1; i <= n; i++) { cin >> ar2[i]; } for (j = 1; j <= m; j++) ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 65; bool w[N][N]; int a[N], b[N]; long long A[N * N], B[N * N]; inline int gi() { int x = 0, o = 1; char ch = getchar(); while (ch < '0' || ch > '9') ch == '-' ? o = -1 : 0, ch = getchar(); while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = get...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ','); cerr.writ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; template <typename _T> inline void _DBG(const char *s, _T x) { cerr << s << " = " << x << "\n"; } template <typename _T, typename... args> void _DBG(const char *s, _T x, args... a) { while (*s != ',') cerr << *s++; cerr << " = " << x << ','; _DBG(s + 1, a...); } con...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; using i64 = long long; int const MAXN = 66; int const MAXX = 22000; int n, m; int a[MAXN]; int b[MAXN]; vector<int> all; i64 mask_[2 * MAXX][2]; auto mask = mask_ + MAXX; int main() { cin.tie(0); ios_base::sync_with_stdio(0); cout << fixed << setprecision(10); cin >...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int maxn = 100; bitset<60> va[50000], vb[50000]; int a[maxn], b[maxn], c[5000]; int main() { int n, m; cin >> n >> m; int cnt = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] += 10000; } for (int i = 1; i <= m; i++) { cin >> b[i]; b[i]...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m, i, j, y, maxi = 0; vector<int> v1, v2; map<int, pair<long long, long long>> mp; cin >> n >> m; for (i = 0; i < n; i++) { cin >> y; v1.push_back(y); } for (i = 0; i ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 100; int yy1[N], y2[N], v1[N], v2[N]; int cnt[300000], vis[300000], viscnt; const int L = 100000; int main(void) { int n, m; scanf("%d %d", &n, &m); for (int i = 0; i < n; i++) cin >> yy1[i]; for (int i = 0; i < m; i++) cin >> y2[i]; sort(yy1, yy1 + ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const long long int inf = 1000000000; const long long int mod = 1000000000 + 7; inline void IO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } inline int dcmp(long double x) { return x < -1e-12 ? -1 : (x > 1e-12); } template <class T> inline int CHECK(T M...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; void getint(int &v) { char ch, fu = 0; for (ch = '*'; (ch < '0' || ch > '9') && ch != '-'; ch = getchar()) ; if (ch == '-') fu = 1, ch = getchar(); for (v = 0; ch >= '0' && ch <= '9'; ch = getchar()) v = v * 10 + ch - '0'; if (fu) v = -v; } bool g[500010], h[5...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; inline ostream &operator<<(ostream &os, vector<int> v) { vector<int>::iterator it = v.begin(); os << "<"; while (it != v.end()) { os << *it; it++; if (it != v.end()) os << ", "; } os << ">"; return os; } inline ostream &operator<<(ostream &os, vector...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 66; int z1[N], z2[N]; int n, m; const int B = 5e4; vector<int> dest[B]; vector<vector<int>> destPos; void getDest() { for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { int pos = z1[i] + z2[j] + B / 2; dest[pos].push_back(i); des...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int MAXN = 65; static int N, M, K, ans, A[MAXN], B[MAXN], S[MAXN * MAXN]; static bitset<MAXN * 2> mask[MAXN * MAXN]; int main() { scanf("%d%d", &N, &M); for (int i = 0; i < N; i++) scanf("%d", &A[i]); for (int i = 0; i < M; i++) scanf("%d", &B[i]); for (int i ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int a[61], b[61]; for (int i = 0; i < n; ++i) { cin >> a[i]; a[i] += 10000; } for (int i = 0; i < m; ++i) { cin >> b[i]; b[i] += 10000; } bool chk[40005] = {}; bitset<120> cnt[40005]; for (int i = 0; ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; template <class T> inline void amin(T &x, const T &y) { if (y < x) x = y; } template <class T> inline void amax(T &x, const T &y) { if (x < y) x = y; } template <class Iter> void rprintf(const char *fmt, Iter begin, Iter end) { for (bool sp = 0; begin != end; ++begin)...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> #pragma optimize("TKACHENKO-GORYACHENKO") #pragma GCC optimize("O3") using namespace std; const long long maxn = 70; const long long maxc = 1e6; const long long shift = 1e5; long long n, m, k; set<long long> II; vector<long long> I; vector<long long> A; vector<long long> B; long long CB[maxc]; ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int n, m, a[100005], b[100005], it, ans; long long ha[100005], hb[100005]; vector<int> bl[100005]; int main() { scanf("%d %d", &n, &m); for (int i = (0); i < (n); i++) scanf("%d", &a[i]); for (int i = (0); i < (m); i++) scanf("%d", &b[i]); for (int i = (0); i < (m);...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; } template <typename T> ostream& operator<<(ostream& os, vector<T> v) { for (int i = 0; i < (v.size()); ++i) os << v[i] <...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const long long maxn = 4005; long long l[maxn], r[maxn]; map<long long, long long> ans; long long lc[maxn], rc[maxn]; long long getones(long long x) { long long ans = 0; while (x) { if (x % 2) ans++; x /= 2; } return ans; } int main() { long long n, m; w...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; pair<int, int> x1[100], x2[100]; map<int, int> id; int intersect[100][100]; int loose[5000][5000]; int win[5000]; int main() { int n, m; cin >> n >> m; vector<int> inputx(n), inputy(m); for (auto& i : inputx) cin >> i; for (auto& i : inputy) cin >> i; sort(input...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const string yno[2] = {"NO\n", "YES\n"}; int dem(vector<int> &a, int k) { return upper_bound(a.begin(), a.end(), k) - lower_bound(a.begin(), a.end(), k); } int dem(long long k) { int ans = 0; while (k) { ans += k & 1; k >>= 1; } return ans; } void...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; using cord = long double; const long double PI = acos(-1); const long double EPS = 1e-8; int signal(cord x) { return (x > EPS) - (x < -EPS); } struct point { cord x, y; point(cord _x, cord _y) : x(_x), y(_y) {} point() : x(0), y(0) {} void operator=(const point& p) ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; long long int count(set<long long int>::iterator first1, set<long long int>::iterator last1, set<long long int>::iterator first2, set<long long int>::iterator last2) { long long int r = 0; while (first1 != last...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.stream.IntStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.Set; import java.util.HashMap; import java.util.InputMismatchException...
JAVA
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } long long qpow(long long a, long long b) { long long ans = 1, base = a; while (b) { if (b & 1) { ans *= base; } base *= base; b >>= 1; } return ans; } int y11[100], y22[100]; long lon...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; bitset<130> q[4000], c; double a[1001], b[1001]; int indec, n, m, ans; map<double, int> mp; void prep() { for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { double po = (a[i] + b[j]) / 2; int pos; if (mp[po]) pos = mp[po]; else...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int n, m; int a[100], b[100]; int cnt = 0; bitset<150> t[4010], p; map<int, int> mp; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) cin >> a[i]; for (int j = 1; j <= m; j++) cin >> b[j]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
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; bool ex[3619][129]; int ccc[3619]; int cd[129]; vector<int> cc[3619]; int main() { cin.sync_with_stdio(0); cin.tie(0);...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; using li = long long; using ld = long double; using pii = pair<int, int>; const int INF = 2e9 + 13; const int M = 1e9 + 7; const int N = 200 + 13; const int K = N * 30; const int LOG = 30; int get(li mask) { int res = 0; for (int i = 0; i < 62; i++) res += (mask >> i) &...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int bcnt(long long a) { long long r(0); while (a) { r += a & 1; a >>= 1; } return r; } map<int, long long> lma, rma; int __pre[int(1 << 20)]; inline int bc(long long x) { return __pre[x & (int(1 << 20) - 1)] + __pre[(x >> 20) & (int(1 << 20) - 1)] + ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
import java.util.ArrayList; import java.util.Scanner; import java.lang.StringBuilder; import java.util.Arrays; import java.util.Stack; //maintain: array on vertices //a[i]: public class Test10 { public static void main(String[] Args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt()...
JAVA
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int const M = 4000 + 10, M2 = 1e7 + 10, mod = 1e9 + 7, mod2 = 1e9 + 9, inf = 1e9 + 10; map<int, int> to; int bad[M][M], cnt = 0, good[M], vis[M][M], vis2[M][M], a[M], b[M]; vector<int> ca1[M], ca2[M]; int32_t main() { int n, m; cin >> n >> m; for (int i = 1;...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const long long INF = 1000000000000000000LL; const long long NMAX = 1e6 + 4; const long long mod = 1e9 + 7; const double eps = 1e-10; const double PI = acos(-1); vector<long long> l, r; long long N, M; vector<pair<bitset<63>, bitset<63>>> hits; signed main() { ios::sync_w...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 65; int a[N], b[N]; pair<long long, long long> mask[N * N]; int n, m; pair<long long, long long> kill(int p) { pair<long long, long long> res = {0, 0}; for (int i = 0; i < n; ++i) { int x = p - a[i]; for (int j = 0; j < m; ++j) if (b[j] == x)...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } sort(a.begin(), a.end()); vector<pair<int, int> > a2; a2.push_back(pair<int, int>(a[0], 1)); for (int i = 1; i...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int MAXX = 10000; int n, m; int a[60]; vector<int> as[60]; int b[60]; vector<int> bs[60]; int x[20001]; int y[20001]; vector<int> pos; char cnt2[3600][3600]; int cnt1[3600]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for (int i =...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; vector<int> a(n), b(m); for (int i = 0; i < n; ++i) { cin >> a[i]; a[i] *= 2; } for (int i = 0; i < m; ++i) { cin >> b[i]; b[i] *= 2; } sort(a.begin(), a.end()); sort...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ','); cerr.writ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
//package round488; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class C { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), m = n...
JAVA
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int n, m, a[100], b[100], s[4000], cnt; bitset<130> c[40005]; void work() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) scanf("%d", &a[i]), a[i] += 10000; for (int i = 1; i <= m; i++) scanf("%d", &b[i]), b[i] += 10000; for (int i = 1; i <= n; i++) for (i...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int n, m, a[110], b[110], F[5010], size[1 << 16], cnt; unsigned long long t1[40010], t2[40010]; const int Z = 20002; inline int getsize(unsigned long long x) { return size[x & 65535] + size[(x >> 16) & 65535] + size[(x >> 32) & 65535] + size[(x >> 48) & 65535]; }...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int base = 20010; int y_1[100], y2[100], s[5000]; bitset<130> b[41010], tmp; int main() { int i, j, n, m, top, y, num, ans; scanf("%d%d", &n, &m); if (n == 1 && m == 1) { printf("2\n"); return 0; } for (i = 1; i <= n; i++) { scanf("%d", &y_1[i]);...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MAXN = 65; int N[2]; int Y[2][MAXN]; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> N[0] >> N[1]; for (int z = 0; z < 2; z++) { for (int i = 0; i < N[z]; i++) { cin >> Y[z][i]; } } unordered...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int NN = 77; using INT = long long; INT A[NN * NN], B[NN * NN]; int a[NN], b[NN]; int po[NN * NN]; int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) scanf("%d", a + i); for (int i = 1; i <= m; i++) scanf("%d", b + i); int cnt = 0; ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int n, t; long long z; long long power(long long x, long long y) { long long res = 1; x = x % z; while (y > 0) { if (y & 1) res = (res * x) % z; y = y >> 1; x = (x * x) % z; } return res; } int main() { ios_base::sync_with_stdio(false); cin.tie(NUL...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int in() { int x; scanf("%d", &x); return x; } long long lin() { long long x; scanf("%lld", &x); return x; } int count(long long x) { return __builtin_popcount(x & ((1LL << 31) - 1)) + __builtin_popcount(x >> 31); } int main() { int n, m; cin >> n...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int max_n = 65, maxy = 40111, inf = 1000111222; vector<int> l, r; vector<pair<int, int>> per[maxy]; vector<pair<long long, long long>> msk; inline int cntb(long long a) {} int main() { int lc, rc; cin >> lc >> rc; for (int i = 0; i < lc; ++i) { int y; ci...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int BASE = 1000; const double EPS = 1e-7; const int MAX = 17; const int INF = 1000000000; int main() { int n, m; cin >> n >> m; vector<bitset<128> > T; vector<int> A, B; for (int i = (0); i < (n); ++i) { int x; cin >> x; A.push_back(x); } for...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 60 + 10; const int mod = 1e9 + 7; int qpow(int a, int b) { int ans = 1; for (; b >= 1; b >>= 1, a = (long long)a * a % mod) if (b & 1) ans = (long long)ans * a % mod; return ans; } int n, m, y[N], z[N], st[N * N], num[N * N], ans; bool ty[N], tz[N]; ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; public class Main...
JAVA
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 65; int n, m; struct Inter { int x, u, v; bool operator<(const Inter& B) const { return x < B.x; } } q[N * N]; int A[N], B[N]; long long resa[N * N], resb[N * N]; int s; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) scanf("%d", &A[i]...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int n, m, a[10000], b[10000]; const int o = 20000; long long d[40005][2]; int ans; int getint() { char ch; int f = 1; while (!isdigit(ch = getchar())) if (ch == '-') f = -1; int x = ch - 48; while (isdigit(ch = getchar())) x = x * 10 + ch - 48; return x * f;...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> int dr[] = {2, 2, -2, -2, 1, -1, 1, -1}; int dc[] = {1, -1, 1, -1, 2, 2, -2, -2}; int dr1[] = {0, 0, 1, 1, 1, -1, -1, -1}; int dc1[] = {1, -1, 1, 0, -1, 0, 1, -1}; int dr2[] = {0, 0, 1, -1}; int dc2[] = {1, -1, 0, 0}; using namespace std; long long a[200005], b[200005]; long long mark[200005], ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int a[67], b[67], n, m; map<int, long long> l, r; vector<int> g; inline int shu(long long a, int p) { int v = 0, len = p ? m : n; for (int i = 0; i < len; i++) { if (a >> i & 1) v++; } return v; } long long l1[100007], r1[100007]; int main() { cin.tie(0); io...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; map<double, pair<long long, long long> > mp; pair<long long, long long> s[50005]; int a[105], b[105]; int n, m; bool cmp(pair<double, int> a, pair<double, int> b) { return a.second > b.second; } int bitcnt(long long x) { int ans = 0; while (x) { ans++; x -= (x...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 60; const int M = 40010; const int OFF = 20005; int n, m; int lt[N], rt[N]; set<int> cnt; bitset<N> ll[M], rr[M]; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> lt[i]; } for (int i = 0; i < m; i++) { cin >> rt[i]; for (int...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using ll = long long; using ld = long double; using ull = unsigned long long; using namespace std; const int N = 61; const ld eps = 1e-9; int n, m, y[2][N], ans; bool in[2][N]; vector<ld> po; vector<int> cl[2]; vector<pair<int, int> > con[N * N]; int main() { ios_base::sync_with_stdio(false);...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; int read() { int k = 0, f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = -1; for (; isdigit(c); c = getchar()) k = k * 10 + c - '0'; return k * f; } const int N = 105; bitset<150> st[5000]; map<int, int> mp; int n, m, tot, a[N], ...
CPP
993_C. Careful Maneuvering
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa...
2
9
#include <bits/stdc++.h> using namespace std; template <class T> ostream &operator<<(ostream &os, vector<T> v) { for (long long i = (0); i < ((long long)(v).size()); i++) os << (i ? " " : "") << v[i]; return os; } const bool debug = 1; const long long OFF = 25000; signed main() { ios::sync_with_stdio(false); ...
CPP